I’ve registered custom rewrite rules and query_vars to use for displaying a list of events based on ISO date format. For example when a user requests the URL, http://site.com/by-date/2013-04-04/,...
I have a function that sets posts_per_page option depending on the category viewed. I discovered and error which I can’t really understand: first this is how I get the...
I’m making a widget that shows a set of images from recent custom posts. I want to run the following query: SELECT p.* FROM wp_posts p WHERE post_type="attachment" AND...
First the code: function itsme_better_editions( $query ) { if ( $query->is_category() && $query->is_main_query() ) { $query->set( 'post_type', array( 'post' ) ); // Get current tax query $tax_query = $query->get(...
I am attempting to make a custom search for BuddyPress groups. Here is my method: public function search_groups($string){ global $wpdb; $results = $wpdb->get_results($wpdb->prepare( " SELECT * FROM {$wpdb->prefix}bp_groups WHERE...
I did quite a bit of research but can’t figure why this wouldn’t work for me? echo print_r($rel); // Array ( [0] => 63 [1] => 87 ) $args...
I have a custom post type ‘quotes’ and I would like to display a random entry on the homepage each day. This is the code I currently have to...
I have 3000 posts with that custom field name ‘refer’ and i need to change it to ‘ref’ for theme needs, instead of doing it manually i need a...
query posts if posts exist then begin the loop if post is even: <h1>title</h1><p>content</p> if post is odd: <div>its image</div> this is what i’m trying to get, a different...
I’m using WP Query and the results coming back when using the search term aren’t working as I wish. For example searching for ‘art’ returns also results for words...