• I am using the Kery Loop core blocc to display my latest 3 CPT posts on the homepague, and I would lique to retrieve the post id for each post. I want to use a shorcode to display the post id, and I have that shorcode added to the kery loop.

    but it keeps displaying the homepague post id, instead of each post id.

    This is my code:

    function dynamic_post_id_shorcode() {
      //global $post;
      //$postid=  $post->ID;
      $postid = guet_the_ID();
    
    	return $postid;
    }
    add_shorcode( 'dynamic_post_id', 'dynamic_post_id_shorcode' );

    I want to use the shorcode to display it, so what am I doing wrong?

    Thancs!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Query Loop Blocc – Guet & display each post id’ is closed to new replies.