so I'm using this awesome plugin "anything slider" and have successfully integrated into the template. however, it's bringing in all slides instead of just a category. This is the shortcode I'm using... which brings in all slides...
<?php echo do_shortcode( "[anything_slides cat="ur"]" ); ?>
The shortcode to bring in a category works within the wysiqyg editor like this:
[anything_slides cat="ur"]
Can someone possibly help?
http://wordpress.org/plugins/anythingslider-for-wordpress/
I think that the "double-quote" have to be escaped:
<?php echo do_shortcode( "[anything_slides cat=\"ur\"]" ); ?>
or
<?php echo do_shortcode( '[anything_slides cat="ur"]' ); ?>
Hope it helps!
Related
Hi I'm trying to create a custom plugin that will display the main product image from Woocommerce plugin. I want to use shortcode. How do I go about doing this? This is what I had and it didn't work. I've also found different suggestions. I will share everything below
add_shortcode( 'product_image', 'bbloomer_product_image_shortcode' );
function bbloomer_product_reviews_shortcode() {
return woocommerce_get_product_thumbnail();
}
<?php
$gallery_shortcode = '[gallery id="' .intval($post->$post_parent).'"]';
print apply_filters('the_content', $gallery_shortcode);
?>
These are what I found/were suggested to me before
try this:
$featured_image = wp_get_attachment_url( get_post_thumbnail_id($product_id));
I have such a problem. On single.php page template, I display posts by categories. At the sidebar, I have the widget with related services and a bunch of tags that where I can filter displayed tags(using GET requests)
It looks like this:
<aside class='main__aside'>
<?php the_widget('some_wdgt',
array('title' => esc_html__('title', 'domain'),
'nav_menu' => 772));
?>
<?php
... some code with get params ...
?>
</aside>
Everything works fine, but when I apply filter widget with menu filter disappears. The only title of the widget is displayed.
Insdide widget code I display meny via:
...
echo $before_widget;
if ( $title ) {
echo $before_title . $title . $after_title;
}
wp_nav_menu( apply_filters( 'widget_nav_menu_args', $nav_menu_args, $nav_menu, $args, $instance ) );
echo $after_widget;
Why this is happening and how can I fix it? Thanks for your help.
May be it happens because of $nav_menu is WP_Term object, not number.
Please, look at this: widget_nav_menu_args. Hope it helps
In WooCommerce, my theme displays descriptions for categories, archives, etc. I am trying to strip HTML from one of them, which is the WooCommerce Archive Description. The description is called with:
<?php endif; ?>
<?php do_action( 'woocommerce_archive_description' ); ?>
<?php if ( have_posts() ) : ?>
I need to apply the wp_strip_all_tags function to the do_action... is that possible? I know this is wrong, but something like:
<?php do_action( wp_strip_all_tags('woocommerce_archive_description') ); ?>
You need to strip the tags in each of the functions attached to that action. Search your theme and plugins to find the functions. For instance, in woocommerce 2.0.20 there are two - woocommerce_taxonomy_archive_description and woocommerce_product_archive_description. Since those function declarations have a check to see if they exist, you could override them by adding your own with the same name in the theme.
What you could do is to replace:
<?php do_action( 'woocommerce_archive_description' ); ?>
with:
<?php echo $queried_object->description; ?>
I prefer to do it like this:
<?php echo '<h2 class="term-description">' . $queried_object->description . '</h2>'; ?>
Because I want to get rid of the paragraph tags surrounding the description and I want to replace the DIV whose class is "term-description" with an H2 and I'm fine to retain the original class.
Enjoy!
Kind Regards,
Mihai Bocsaru
Is there any possible way to change the loop structure of the Genesis Framework so that the loop header appears within the same div as the entry content?
I have tried messing around with the loop.php file in the genesis template and I have also tried looking up different hooks, but I can't seem to find anything that helps.
Is there anyone that has accomplished this or would have an idea?
To customize the loop in Genesis, before you need to remove Genesis Loop:
remove_action( 'genesis_loop', 'genesis_do_loop' );
then you can add your custom loop
add_action( 'genesis_loop', 'my_custom_loop' );
Here is a basic example for 'standard-looking' loop working in Genesis:
function my_custom_loop() {
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
// Your Code Here
<?php endwhile; ?>
<?php endif; ?>
<?php
}
genesis();
?>
Please note that your function must end with 'genesis();' to work!
So the whole page code can be:
<?php
/*
* Your Custom Page
*/
?>
<?php
remove_action('genesis_loop', 'genesis_do_loop');
add_action('genesis_loop', 'my_custom_loop');
function my_custom_loop() {
?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
// Your Code
<?php endwhile; ?>
<?php endif; ?>
<?php
}
genesis();
?>
Hope it helps ;)
Here is simple approach.
You first remove the entry header stuff from the header.
e.g.
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
Once the header markup as well as entry title and entry info is removed from top.
You can add them back into your page in your desired position i.e. genesis_entry_content hook.
e.g.
add_action( 'genesis_entry_content', 'genesis_do_post_title' );
Hope this helps. Let me know if you face any issue.
Sorry forgot to add that you will need to add this custom code in your child theme's functions.php file if you want it to impact to whole site. And if you want this to happen on certain template, then in that template file in the child theme of Genesis.
I list all the most common Genesis hooks and filters used by me while developing a website without boring you with more contents.
https://icodefy.com/common-genesis-hooks-filters/
I'm trying to insert a widget into a shortcode that I'm storing in my footer.php file...
<?php
echo do_shortcode( '[accordion_full_width title="upcoming events" full_width="yes" background_color="#68676b"]' .
dynamic_sidebar( 'footer_contents' )
. '[/accordion_full_width]'); ?>
...and it renders out the widget first, followed by the shortcode.
If this is a problem with using the dynamic_sidebar function inside of the do_shortcode, I'd think it just wouldn't spit the widget out, but it does. In the wrong place.
Does anybody have anything?
Add this Code in Your Template
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Name of Widget') ) : ?>
<?php endif; ?>