Skip Navigation

[Resolved] taxonomy which is also a post?

This support ticket is created 6 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 3 replies, has 1 voice.

Last updated by Ido Angel 6 years, 1 month ago.

Assisted by: Waqar.

Author
Posts
#1145256

hey,

i have an index site of writers. the post (a writer) has some custom fields like "genres", "year of birth" etc, but there are also fields like "was influenced by" and "was in contact with". some ppl from these fields are also writers (e.g posts, and not custom fields). meaning:

writer A can be "influenced by" person B (who is not a writer), but can be "in contact with" Writer B, who is both a custom field ("was in contact with") and an actual post.

basically, so far so good. but what i'm trying to achieve is that in search results, when a custom field appears and clicked, and i go to the custom field's archive page (to see, for example, "all writers who were influnced by PERSON B"), I want to have a few details from the actual post: the name, maybe a link, year of birth etc.

is this even possible, to find a matching post according to a custom field, if they are the exact same?

#1145278

update: i managed to get a link from the archive of the taxonomy (it's not a custom field) to the post with the same slug using the [wpv-taxonomy-archive info='slug'] shortcode:

[wpv-taxonomy-archive info="name"] is actually a writer: <a href="<em><u>hidden link</u></em> info='slug']">[wpv-taxonomy-archive info="name"]</a>

but:

1. a link is easy. how do i show some custom fields of the writer (e.g post) in the taxonomy?
2. how do i display this conditionally? since not all people in "was in contact with" taxonomy are actual posts too, i want to display the extra info only if the ARE.

thx!

#1145290

*clarify:

for 1: i'm looking for a view which will have a filter of "display posts only matching the current archive's title". is this possible? is there a better way to go about this?
for 2: i need a conditional along the lines of "display this only if there's an actual post matching the title of the current taxonomy". i think maybe i can achieve that by creating a checkbox custom field for the taxonomy (i can call it "is an actual post" or something") and in all taxonomies which are actual posts i should check the box, then i can set a conditional of "display this only if the checkbox 'is actual post' is checked".

#1145305

UPDATE:

I managed to get this working 🙂

- I added a custom field to all posts, called "name" ( i needed that as you don't have a name filter).
- i made all "name" custom fields identical to the actual post title.
- i created a view for posts, showing title and whatever custom fields i wanted, and filtered them by the custom field "name" according to a custom shortcode attribute i created, "isentry".
- i created an archive view for the "was in contact with" taxonomy, and placed this code just after [/wpv-items-found] (out side of the loop):

[wpv-view name="writer-who-is-a-taxonomy" isentry="[wpv-taxonomy-archive info='name']"]

success! and 2 birds in one shot:

1. now the post view is filtered by the "name" (which is identical to the title) of the post, and the shortcode attribute takes care that the name of the post is the name of the taxonomy term.
2. in the [wpv-no-items-found] in the post view, i just deleted everything, so that when there are no posts with the same name as the current archive term name - nothing is shown!

hooray to me 🙂
and thanks for listening lol 🙂