List the linked titles of posts in a custom post type related to the page I'm on
-
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.
- 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.