Home › Forums › Pro Version › after using custom query shortcode in page keeps loading…
Tagged: Custom Query
- This topic has 7 replies, 3 voices, and was last updated 4 years, 4 months ago by
Masonry Guy.
- AuthorPosts
Joke Portegies
ParticipantI want to display only the top-level categories, but posts on the sublevels are showing too. I thought I could use a custom query to filter out the subcategories, but now my layout is not loading. This is the syntax I used: meta_key=category__not_in&meta_value=kleding. I tried to use quotes around ‘kleding’ but that gives the same result…
What am I doing wrong?
Masonry Guy
KeymasterHi,
The custom query you have written is not in right order. For category you can’t use meta_key. That are for custom fields.
You can use this in custom meta query category__in=123 . Where 123 is the id of your category.
Thanks
Joke Portegies
ParticipantStill doesn’t work. The custom query is now the only filter I use to narrow down the posts I want to see, in a 3-column layout. In the Custom Query I put this: category__in=9 . Still keeps loading and not showing…
Masonry Guy
KeymasterHi,
In that case, can you please send me your wp-admin details with this thread url. I will try to check your category structure and fix it.
Thanks.
Joke Portegies
GuestHi, I think I’m a bit further in understanding. At least I have a layout now. But I still don’t know how to filter out posts from the subcategory.
My maincategory is 111 and 112, 113 and 114 are subcategories. You can find my page here: http://www.jannytermeer.nl/Wordpress/test-voor-nieuwe-homepagina/. The only posts I want to see are the posts with the pictures. The other posts are from the subcategories.I tried this custom query syntax now, trying to filter out the posts from category 112, 113 and 114 (which are the subcategory’s): category__not_in=array(112,113,114). But the posts keep appearing. Again the wrong syntax?
Groete, Joke
Masonry Guy
KeymasterHi Joke,
Any chance you can try this format ? category__not_in=112,113,114 ? I am sorry about not being sure myself. That was the reason i asked for the wp-admin details, so that i can try and test here.
Thanks
Joke Portegies
Guesthi Masonry Guy, thank you for your patience. I actually made some printscreens, to show the structure of the main-category and the subcategories, but I could not figure out how to send them with this message. But I got wiser studying the images myself, so I thought I’ld give it another try.
When I use the category__not_in=112,113,114 the result is that my posts with category 112 are filtered out. The other ones are still in.
I think I must drop they idea of filtering out the maincategory. I think I’m going to use the meta_key and meta_values, like I did abusively in the first place. Thank you for thinking with me!
Masonry Guy
KeymasterHi Joke,
One of the best idea will be to filter out based in tags if it is applicable for you.
Thanks
- AuthorPosts