• Resolved ceco

    (@ceco)


    I’ve followed this thread

    https://www.ads-software.com/support/topic/69219?replies=3

    to get the title for an specific post but I cannot get it to work. The code I’m using is:

    <?php echo
    $my_id = 414;
    $post_id_414 = get_post($my_id);
    $title = $post_id_414->post_title;
    ?>

    where 414 is the id of the post in wordpress. When I run the script I get 414 instead of the title.

    Any suggestions?

Viewing 2 replies - 16 through 17 (of 17 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Yikes.

    Try this instead:

    <?php if($show_thanks) { ?>
        Thank you.
        <?php } else { ?>
    	Submit your details below to be entered into
    <?php echo get_the_title(414);
    }
    ?>

    Minor change, but still. Might save you some headaches later.

    I’m glad you figured it out!

Viewing 2 replies - 16 through 17 (of 17 total)
  • The topic ‘Get title for specific post’ is closed to new replies.