How can i show all categories using wp query?
You should be able to remove that category from the query so you would have<?php $recent->query(‘showposts=2’); ?> you can also take a look at completely custom queries here. `
You should be able to remove that category from the query so you would have<?php $recent->query(‘showposts=2’); ?> you can also take a look at completely custom queries here. `
Try using the filter get_the_categories and replace every occurrence of the_category by echo get_the_category() (just to be sure !) This is what I cooked: <?php add_filter(‘get_the_categories’, ‘exc_cat’); function exc_cat($cats) { //not on admin pages if(!is_admin()){ $exc = array(‘lipsum’, ‘dolor’); foreach ($cats as $i=>$cat){ if(in_array($cat->name, $exc)){ unset($cats[$i]); } } } return $cats; } ?> Try my … Read more
The $wpdb class properties You can use all the default WordPress tables like this: $GLOBALS[‘wpdb’]->postmeta so no need to use prefix, etc. meta_query As you can see from the Custom field parameter documentation, there’s nothing like the <> (or in other words: “not equal to”) operator. The equivalent operator in WP should be != (human … Read more
To at least answer the title of your question, the pre_get_posts filter may be useful. From the Codex: This hook is called after the query variable object is created, but before the actual query is run. The pre_get_posts action gives developers access to the $query object by reference (any changes you make to $query are … Read more
Dynamically adjust single-posttype.php query, based on current taxonomies
WordPress Query wp-terms SLOW
You are asking for the last three posts ordered by post date, not for the posts from the last three days– ORDER BY post_date DESC LIMIT 3. post_date has a time component to it. It is not just marked with a date. Even so, that LIMIT would restrict the query to last three in the … Read more
Your question isn’t much of a WordPress related question, more like a MySQL question. But I have sort of a solution in my head: You could go with a custom query and a replace on the apostrophe: SELECT * FROM `table` WHERE REPLACE( `column`, “‘”, “”) LIKE REPLACE( ‘string’, “‘”, “” ) For a combined … Read more
WordPress Query orderby title with UTF8 string in title
The answer is… I’m an idiot! (sort of) My query is fine. It’s not pulling the post I expected it to because I had a LIMIT of 7 and when organized by date my expected post was further than 7 down the line. I was getting confused because the end result of this is a … Read more