0

I'm really new to code, so forgive me if the question seems dull.

I have set up a very simple WP site its only purpose is to collect content from authors to then export some xml file in order to create an Indesign document. Content has the same format throughout (there are some ACF for the authors to upload it in a organised way) and each post has an assigned category.

The site has 29 category in total (which are the London Boroughs) and posts (Buildings name with address and description) are organised alphabetically with query_posts($query_string . '&orderby=title&order=ASC');in category.php.

Now: one category is slightly different. It's called Walk and Tours; here I collect content which is slightly different. Posts with this category will also have one (only one) from the another categories assigned (i.e 'Walks and Tours, 'Westminster').

I'd like to append the content of this category at the end of the post's other assigned category's page (See example below of aimed result).

Category: 'Westminster'
post 1,
post 2,
post 3,
...

Category 'Walks and Tours', 'Westminster)
post x
post y
post z

I assume there's a need for a simple conditional statement that says "If this post has this category and this category too, then append (?).

Hope to find and answer here! Many thanks, A

1
  • you might need to append a custom query and loop based on the ids of current category and the category 'walks and tours', using 'category__and' as parameter; codex.wordpress.org/Class_Reference/…
    – Michael
    Jul 9, 2016 at 20:55

1 Answer 1

0
if ( in_category('Walks and Tours') && in_category('Westminster') ) {

//append whatever

}

You'd place that where you want the output to occur, within the Loop, of course.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.