Community Forums › Forums › Archived Forums › General Discussion › Custom Post ID and Plugin Shortcode
- This topic has 4 replies, 2 voices, and was last updated 9 years, 2 months ago by
CYBERsprout.
-
AuthorPosts
-
December 22, 2015 at 9:13 pm #174597
CYBERsprout
MemberI'm trying to print a custom post id for some shortcode that needs the id. There is some error that I'm missing.
The code is placed in the genesis_entry_content hook. Any suggestions are much appreciated!
<?php
if (is_singular('wpseo_locations')) {[wpseo_address id="<?php the_ID(); ?>" hide_name="1" show_state="1" show_country="0" show_phone="1" show_phone_2="0" show_fax="0" show_email="0" show_url="1"]
[wpseo_map id="<?php the_ID(); ?>" width="1000" height="500" zoom="-1" map_style="roadmap" scrollable="1" draggable="1" show_route="0" show_state="0"]
<?php }
?>December 22, 2015 at 10:33 pm #174607Brad Dalton
ParticipantPlease embed your code correctly so it can be tested.
Also, use the 2nd and 3rd code snippets on this page as a guide to learning how to print a shortcode.
You'll need to change the hook, conditional tag and shortcode in the code example.
December 23, 2015 at 10:34 am #174646CYBERsprout
MemberBrad, thanks for the reply. I should mention that I'm using the Genesis Simple Hooks plugin. The code is outputting in the right place but essentially breaks when it is supposed to start pulling data based on the custom post id. Should I still be using do_shortcode()?
<?php if (is_singular('wpseo_locations')) { echo "<b>Contact Details</b><br>";?> [wpseo_address id="<?php the_ID(); ?>" hide_name="1" show_state="1" show_country="0" show_phone="1" show_phone_2="0" show_fax="0" show_email="0" show_url="1"] [wpseo_map id="<?php the_ID(); ?>" width="1000" height="500" zoom="-1" map_style="roadmap" scrollable="1" draggable="1" show_route="0" show_state="0"] <?php } ?>
Here is what it outputs:
Contact Details URL:
December 27, 2015 at 12:15 pm #174606Brad Dalton
ParticipantPlease embed your code correctly so it can be tested.
Also, use the 2nd and 3rd code snippets on this page as a guide to learning how to print a shortcode.
You'll need to change the hook location, conditional tag and shortcode in the code example.
January 2, 2016 at 10:13 am #175391CYBERsprout
MemberI can't get it to work with '
' tag so I haven't used it. It keeps outputting like this: [php]<?php if (is_singular('wpseo_locations')) { echo "<b>Contact Details</b><br>";?> [wpseo_address id="<?php the_ID(); ?>" hide_name="1" show_state="1" show_country="0" show_phone="1" show_phone_2="0" show_fax="0" show_email="0" show_url="1"] [wpseo_map id="<?php the_ID(); ?>" width="1000" height="500" zoom="-1" map_style="roadmap" scrollable="1" draggable="1" show_route="0" show_state="0"] <?php } ?>
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.