1
votes

DESCRIPTION: I have a situation where extracts of my blog posts show up as boxes on my homepage. However, I use pages for static menu items in the site. For instance, if an event is coming up, I'll create a page for the event. That page doesn't show in what is returned from my WP_Query loop, though, so it never exists on the homepage as a "new" item. Instead, I have to create a blog post (which will get returned by the loop) which basically just acts as a pass-through, asking the user to click one more link to get to the actual page with the information they are looking for. A pain.

WHAT I'VE DONE: I've done a ton of searching, but lot of the returns just misinterpret my keywords and give me pages about "how to get your posts to different pages." I have also read the WP_Query documentation page. It seems that the taxonomy parameter has a "relation" component that mimics some of the functionality I need, but that is only for posts.

WHAT I NEED: It seems I need some kind of "OR" case for the union of ALL posts plus CERTAIN pages. I know from the documentation I can do something like:

    $query = new WP_Query( array(
                 'post_type' => array( 'post', 'page'), 
                 'post__in' => array( 2, 5, 12, 14, 20 ) ) );

Which would get me the pages I'm looking for, but I need to know how to marry that to language that includes all posts.

It seems there would be a plugin that could do this. I'd be happy with a plugin or help with putting the language together.

1

1 Answers

0
votes

I haven't found an answer to my initial question, but for those who might stumble on this page later, I have found a workaround:

I have put a redirect on the blog posts, forcing them to resolve to the associated page, instead.

For example, if I have Event A that I need to promote, I still have to create the post entry (as that is what shows up in my loop results) for Event A separate from the more permanent page for Event A, but then I assign the post to redirect to the Event A page.

For newbies: redirects can be handled in a lot of different ways, but the easiest might be with a good WP plugin.

I will update if I find an answer to the actual problem I faced.