• Resolved iReal Projects

    (@islamabadprojects)


    Hi,

    I have used Pods to create a custom post type Agents and extend an existing post type Portfolio. Each portfolio is related to one agent while each agent can be related to more than projects.

    I have been trying to use Pods templates and shortcode to show the related projects on the page of agents and vice versa.

    However, the template returns values of all posts rather than one. See the attached link, the agent’s page shows the results for all agents.

    My shortcode is as follows:

    [pods name=”agent” template=”Related Project Template”]

    The issue persists even if I choose add slug=”hammad-akhtar” in this shortcode.

    My Template is as follows:

    [if related_projects]
    <ul style=”list-style: none;” class=”related-projects-css”>
    [each related_projects]
    <li style=”border-bottom: 1px solid black”>

    <h3>{@post_title}</h3>
    <p>Post Status: {@post_status}</p>
    <p>Post Type: {@post_type}</p>
    <p>Related Agent: {@related_agent}</p>

    [/each]
    [else]
    There are no projects associated with this agent.
    [/if]

    I would really appreciate your help. I have been juggling with this issue for 4 days now. It’s a great plugin, however, this issue is a huge hurdle and is making it useless for me.

    Thanks a lot,
    Sana Sahban

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi
    You need to add a filter to your query that specifies your name of someone elses name.

    You would normally use ‘Where’, but like you I have been on this for days and can’t get it to work.

    Morris.

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @islamabadprojects

    Where/How are you using the shortcode?

    The current shortcode you use doesn’t contain any context to the current object (page).
    Please try to remove the name attribute. If the shortcode is in the loop it should automatically detect the current object.

    Cheers, Jory

    @morris373
    It looks like you are talking about the field filter, that isn’t related to this topic.

    Thread Starter iReal Projects

    (@islamabadprojects)

    Hi Jory,

    Thanks a lot for your quick response. I am placing the shortcode in the text editor. Actually, I plan to use the shortcode in a widget or in an off canvas bar. The goal is to show the respective agent on each page automatically in the sticky sidebar or off-canvas. Also, I am trying to show the agent’s portfolio on the agent’s page (text editor should work for this part).

    From what I get, should the following version work to detect the current page?

    [pods template=”Related Project Template”]

    Best,
    Sana

    Thread Starter iReal Projects

    (@islamabadprojects)

    @keraweb I have tried this [pods template=”Related Project Template”] instead, however, there is no change in the result.

    I don’t understand how and where to insert reference to the current page while keeping it dynamic. It would be very helpful if you could elaborate on this.

    Thanks,
    Sana

    Thread Starter iReal Projects

    (@islamabadprojects)

    Update on the issue:

    The above change in shortcode seems to have worked.

    It wasn’t showing the correct results yesterday most probably due to browser caching.

    To display data of relational posts, the following shortcode should work:
    [pods template=”your-template-name”]

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @islamabadprojects

    Good to hear it worked for you! And indeed, cache is an issue in most cases when something isn’t displaying while it should.

    Good luck with your project!

    Cheers, Jory

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Cannot show Relationship Post Correctly – Template shows results for all posts’ is closed to new replies.