Support » Fixing WordPress » Displaying post ID within shortcode php in template

  • Resolved PinkishHue

    (@pinkishhue)


    Hi folks,

    In my single.php template under the post content I have the code for a shortcode with some html between the opening and closing parts of the shortcode.

    Within the html I would like to display the post ID, however the usual method ‘<?php the_ID(); ?>’ doesn’t seem to be working. There’s probably a simple way to get around this – can anyone advise me?

    Example:

    ‘<?php echo do_shortcode(‘[hide-this-part]

    this is where I put my html…blablabla…

    [/hide-this-part]’); ?>’

    This is before the end of the loop.

    Thanks a lot for any help you can give me.

    Jo

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Displaying post ID within shortcode php in template’ is closed to new replies.