WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Shortcode attribute from one post (7 posts)

  1. yox64
    Member
    Posted 1 year ago #

    Hi there!

    I have a plugin that creates a shortcode [groups tags="tag-name"], that gets the tags attribute and shows all the posts with those tags.

    The problem is that if I have two posts with two different shortcode attributes (post1: [groups tags="Actors"], post2: [groups tags="Singers"] ), when I go to one of those posts pages, it shows all the posts with Actors and Singers, when it should show only the posts with the shortcode that has the attributes(post1 should show only posts with actors and post2 should show only posts with singer).

    So does everyone know how can I fix this?

    Thank you!

  2. alchymyth
    Forum Moderator
    Posted 1 year ago #

    what plugin?

    where did you download the plugin from?

    does the plugin have instructions for how to use the attributes?

    you might need to dig into the plugin's files to find teh code which creates the post list ...

  3. yox64
    Member
    Posted 1 year ago #

    I created my own plugin that creates another post type and enables the usage of this shortcode.

  4. alchymyth
    Forum Moderator
    Posted 1 year ago #

    I created my own plugin

    bingo - then you will know best what code is used to retrieve the posts according to the tags attribute;

    you are allowed to use the pastebin to share the code (see http://codex.wordpress.org/Forum_Welcome#Posting_Code ) so somebody could have a chance to check it.

  5. yox64
    Member
    Posted 1 year ago #

    This ( http://pastebin.com/Fup7Lw3u ) is the code that I used to create the shortcode. It gets all the required information, but when I access one of the posts page, it does show me posts with shortcode attributes from all posts. I only need shortcodes attributes per post, not all of them.

  6. alchymyth
    Forum Moderator
    Posted 1 year ago #

    review:

    http://codex.wordpress.org/Class_Reference/WP_Query#Tag_Parameters

    'tag_slug__and' expects an array as parameter, and also slugs, i.e. no capital letters or spaces

  7. yox64
    Member
    Posted 1 year ago #

    Thank you!

Topic Closed

This topic has been closed to new replies.

About this Topic