• I want to display all post to a specific category by that post/page tags, something like this:

    <?php echo do_shortcode(“[ic_add_posts category=’specific-category’ tag=’$tag’]”); ?>

    Here i have troubles: tag=’$tag’]

    Something combined with this:

    <?php
    $posttags = get_the_tags();
    if ($posttags) {
    foreach($posttags as $tag) {
    echo $tag->slug . ‘ ‘;
    }
    }
    ?>

    Greetings

    https://www.ads-software.com/extend/plugins/posts-in-page/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author ivycat

    (@ivycat)

    Posted with a different account but it’s not showing up. So Weird.

    Copy and pasted below:

    Hello C3dRy2K,

    Try:

    <?php
        $tags = implode( ',', wp_list_pluck( get_the_tags(), 'slug' ) );
        echo do_shortcode("[ic_add_posts category='test' tags='$tags']");
    ?>

    or for better readability:

    <?php
        $array_of_tag_objects = get_the_tags();
        $tag_array = wp_list_pluck( $array_of_tag_objects, 'slug' );
        $tags = implode( ',', $tag_array );
        echo do_shortcode("[ic_add_posts category='test' tags='$tags']");
    ?>
    Thread Starter Alin Ionut

    (@c3dry2k)

    it doesn’t work. it shows only the posts from “test” category, the page tag is not taken.

    Thread Starter Alin Ionut

    (@c3dry2k)

    perhaps it will work if change that tag with custom url, and i create that custom page url exactly like the tag that i want to appear. Sry, i’m not so good with php, that i ask for help in here.

    C3dRy2K,

    Yep, try changing “test” to whatever category you want to display with the shortcode.

    Are you putting the shortcode in a page or a post? Pages, at least by default, do not have tags, so I’m not sure the get_the_tags() function would work. It might if you have a plugin that allows you to give pages tags, but I’m not certain.

    Plugin Author ivycat

    (@ivycat)

    C3dRy2K,

    Yep, try changing “test” to whatever category you want to display with the shortcode.

    Are you putting the shortcode in a page or a post? Pages, at least by default, do not have tags, so I’m not sure the get_the_tags() function would work. It might if you have a plugin that allows you to give pages tags, but I’m not certain.

    Thread Starter Alin Ionut

    (@c3dry2k)

    Dont worry, i put the category that i hant to display. I put this code into pages. I use this plugin for page tags, Page Tagger.

    Plugin Author Eric Amundson

    (@sewmyheadon)

    Hey C3dRy2K,

    So, you’ve solved this issue, correct?

    Thread Starter Alin Ionut

    (@c3dry2k)

    No Eric, i didn’t solve it. I don’t know how

    Plugin Author Eric Amundson

    (@sewmyheadon)

    Hi C3dRy2k,

    Not entirely sure what to tell you – sounds like you’re using a plugin to tag pages and that may be the issue.

    Can you post the exact code you’re using now (or trying to use)?

    Thanks,
    Eric

    Thread Starter Alin Ionut

    (@c3dry2k)

    I’m not using any php code, because nothing works. I don’t know what to do any more. I just want to display posts in page by tag page
    For example i have “father” page, with tag “tag-father”. And couple of posts with that tag “tag-father” on multiple categoris. i want to display in page “father” posts from category 1 by tag “tag-father”, posts from category 2 by tag “tag-father” and so on.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Post by post/page tag’ is closed to new replies.