Support » Plugin: Pods - Custom Content Types and Fields » List the linked titles of posts in a custom post type related to the page I'm on

  • Resolved theinnographer

    (@theinnographer)


    Hi there!

    Could you help point me in the right direction? The following does exactly what I want:

    ul>
    [pods name="dt_portfolio" where='competencies.post_title = "Test competency"']
    <li><a href="{@permalink}" title={@post_title}">{@post_title}</a></li>
    [/pods]
    </ul>

    It does a beautiful job of listing (on the page from which this shortcode is called) – the (links to) pages in another post type that are related to it. Which is what I want it to do. NOTE that: competencies is a custom post type, and it is a field of dt_portfolio: field type is Relationship, and Related To is Competencies (competency).

    Can you help me do the same – but with code that can be posted on any page, i.e. without hard coding the string “Test competency” – which is the title of the page from which I am calling the shortcode – but instead by using something in the where that gets / returns the same string but for any page on which the shortcode might be used?

    Put another way, is there a way to pass the current (calling) page title into the where, instead of having to specify it as a string?

    I received suggestion to try the following:

    <ul>
    [pods name="dt_portfolio"]
    [each competencies]
    <li><a href="{@permalink,esc_url}" title="{@post_title,esc_attr}">{@post_title}</a></li>
    [/each]
    [/pods]
    </ul>

    But that ends up just listing the linked titles of each of the competencies.

    Rather, I’m trying to list the linked titles of all of the dt_portfolio posts that are related to the page I’m on.

    Thanks!

    Alex.

    https://wordpress.org/plugins/pods/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter theinnographer

    (@theinnographer)

    Update: Jim helped me with this via Slack.

    Here’s what I needed:

    [pods][if tools]
    <ul>
    [each tools]
    <li><a href="{@permalink}">{@post_title}</a></li>
    [/each]
    </ul>
    [/if][/pods]

    And with my sincere thanks for all his time and your great service. Thanks Jim!

    Alex.

    Plugin Author Jim True

    (@jimtrue)

    Yep, we tend to prefer to send people to Slack it does help 😉

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘List the linked titles of posts in a custom post type related to the page I'm on’ is closed to new replies.