Pull shortcode based on current post information
-
If I’m viewing a single post and I want to show a custom-shortcode petition button related to the current page I’m viewing, how do I tell this custom-shortcode petition button to only show a link that pertains to this post?
The shortcode needs to know, that this is the specific page I’m viewing, and this is the specific field button I need to show for this page.
[field petition-button]
If I add
<?php the_sub_field( 'petition_button' ); ?>
to the single.php page template, then the php script knows to show the petition link based on the page I’m viewing. I need the same function, but using custom-shortcode.I hope this makes sense.
- The topic ‘Pull shortcode based on current post information’ is closed to new replies.