• Hi all,
    It would be great if wordpress implement a unique and specific shortcode for any post. I’ll try to explain.
    We have a post with id=1, the shortcodes I have in mind are:
    [post id=1 title] that displays the title of the post with ID 1, [post id=1 excerpt] that displays the excerpt, and [post id=1 body] that displays the body… and so on with other post’s specifics.
    These shortcodes would permit many customization in showing contents.

    Thank you for the attention ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • You can do it yourself ??

    I made this one of the sites as follows: in the page template has prescribed a short code, like <? if (page_id = 'xxx'){...}?>

    The idea is this: after reading the page id to perform the desired piece of code – is prescribed to handle in the template file (I wrote in single.php, I think).

    Be of good cheer. Good luck ??

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Please don’t link to your site unless it’s to specifically help the user. It’s triggering our spam filter because it looks like you’re self-promoting and we don’t like that ??

    Understood. I just did this so that people understand that it really works. Note taken. Sorry ??

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Unless you’re showing them HOW it works, no one can tell the difference between a legit example and any plain old page, you see ?? If you could share the actual code you’re using, that would be great.

    Thread Starter tubia87

    (@tubia87)

    Uhm, please Domino_ukraine try to explain it: if you solved this, would be great!

    ??

    Thank you in advance!

    Still relevant?
    You must use default link in your wp-theme (/wp-admin/options-permalink.php)
    Place this code into single.php

    $tmp = substr($_SERVER['REQUEST_URI'],strpos($_SERVER['REQUEST_URI'],'?p')+3);//get page number
    
    switch ($tmp) {
    case 11://Write your own code to each page
        echo "yourcode1";
        break;
    case 9:
        echo "yourcode2";
        break;
    case 4:
        echo "yourcode13";
        break;
    default://other page
        echo "";
    }

    Somethink like this ??
    Good luck!

    By the way, if you want write code to the page (my example for post)
    change ‘?p’ and +3 in first line to ‘?page_id’and +9

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Specific shortcode for every post’ is closed to new replies.