• Hello everyone,
    Often times inside of a post I add manually related posts links like this:
    “SEE ALSO: Title with link”. This time around, I would like to create a function where I can use a shortcode to enter the post ID and query the post which I can later style anyway I want. Is there anyway I can do this?

    Thanks,

Viewing 1 replies (of 1 total)
  • Thread Starter wpmhweb

    (@wppit)

    Here is an update.
    I created this function:
    ‘function pure_manual_related ($article) {
    $post_id = $article;
    $queried_post = get_post ($post_id);
    echo ‘‘ . $queried_post->post_title . ‘‘;
    }
    add_shortcode(“pmr”, “pure_manual_related”);’

    Then I simply use this shortcode [pmr]postid[/pmr] and I can see the queried post on inside the post. The problem is that it places the new queried post at the beginning of the post instead of below the paragraph I intended the queried post to appear. What I’m doing wrong? And there is anyway to create another shortcode that looks like [pmr=postid]. Something more simplified?

    Thanks,

Viewing 1 replies (of 1 total)
  • The topic ‘Querying one post using ID with shortcode inside of a post’ is closed to new replies.