Insert Dynamic Shortcode into Template
-
Hi,
I’m trying to add a shortcode on the template level. Here is what I have so far:
<?php echo do_shortcode("[ultimate-reviews post_count='1' product_name='NEED_TO_ADD_PRODUCT_NAME_BASED_ON_CURRENT_PAGE']"); ?>I’ve also tried:
<?php echo do_shortcode("[ultimate-reviews post_count='1' product_name='" . $Product->Item_Name . "']"); ?>and
<?php echo do_shortcode("[ultimate-reviews post_count='1' product_name='the_title();']"); ?>Neither worked.
It did work when I manually added the product name for one particular page:
<?php echo do_shortcode("[ultimate-reviews post_count='1' product_name='Angle Broom']"); ?>However, this won’t work, because I need the product name to be dynamic and change based on the current page.
Any suggestions? Thanks!
The page I need help with: [log in to see the link]
The topic ‘Insert Dynamic Shortcode into Template’ is closed to new replies.