0

I don't like to bother you guys, but this is already driving me nuts.

I have a legacy post model within a specific category called 'listas-2' that used shortcodes to show some fancy things. Now I have created a custom post type named 'lista' that does the same thing but way better, using post_metas.

The issue now is that I have to make an archive of both at the same time with pagination, which contains the legacy and new posts. I can't manage to show both at the same time, already tried to add a tax_query but I can't because the custom post type doesn't use it, only the common post. I also tried to merge the queries but I got lots of pagination issues.

The goal: A WP_Query that requests posts within the category 'listas-2' and custom posts named 'lista', that does not have categories.

What can I do? Thanks in advance and sorry for my bad English, Vinicius

1

I really think that you have over complicated things here. Here is how I would treat the matter

  • First of all, create a custom post type (which you have already done)

  • Assign a custom taxonomy to it

  • Convert all the posts from the listas-2 category to your created custom post type. See this post on how to

  • Re-assign your custom taxonomy to these converted posts

| improve this answer | |
  • Hi Pieter! That's what I thought at the first place, but then I realized that I can't do this because these older type of posts have permalinks linked to facebook likes & comments, and doing this migration would make them all disappear. – Vinicius Tavares Aug 29 '14 at 18:14
  • Then why don't you assign the default categories to your custom post type and then assign the custom post type posts to your desired category. This is the only way that I can see to keep your custom query down to one, otherwise you'll need to run two custom queries, and merge them, and as you said, it becomes a mess if you add pagination to the equation – Pieter Goosen Aug 30 '14 at 4:16
  • 1
    I've finally solved this by using a major part of your answer. I've added for the listas-2 category a post_meta called _is_lh_lista and did that for the custom post type too. Now I can query by meta key and value and works like a charm. Thanks for giving the idea! – Vinicius Tavares Sep 8 '14 at 5:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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