Show multiple tax_query from 2 or more post_type in a single code
Answering myself, the problem was the ‘AND’, must be ‘OR’, thank you anyway.
Answering myself, the problem was the ‘AND’, must be ‘OR’, thank you anyway.
Assuming removeCommonWords() returns a string, you can do the following: $zoekterm = removeCommonWords(‘motorkap met’); $query2 = new WP_Query( array( ‘s’ => $zoekterm ) ); while( $query2->have_posts() ) { $query2->the_post(); echo the_title() . ‘</br> ‘; } Sometimes the array notating is more useful than the string notation …
You need to add a query var and rewrite rule to make that work. First, add the query var to WordPress query vars array in your theme’s functions.php: add_filter( ‘query_vars’, ‘wpa58904_query_vars’ ); function wpa58904_query_vars( $query_vars ){ $query_vars[] = ‘my_page’; return $query_vars; } Then add a rewrite rule with your desired pattern that sets your custom … Read more
the_category() only works for the “Category” taxonomy which doesn’t appear to be hooked to your custom post type. I see you’re registering a custom taxonomy. If you want to show the terms from that taxonomy that are assigned to the post, you’ll need to use the_terms() or get_the_terms(): the_terms( $post->ID, ‘fgaleri’, ”, ‘, ‘, ” … Read more
You should be using get_users() – this will perform your query and also allow you to limit by role. http://codex.wordpress.org/Function_Reference/get_users userphoto isn’t a WordPress function, but get_avatar() is: http://codex.wordpress.org/Function_Reference/get_avatar Just check out the Codex examples and you should be able to modify to suit your needs! — UPDATE — I reread and realized maybe userphoto … Read more
You could even try passing ‘post_parent’ => 0 to the query. In your case it would be $query->query( ‘post_type=pages&post_parent=0’ );
I’d use the this code to print the image instead of using the_post_thumbnail();. So that the $slider_query->current_post can be used to print the current iteration of post in WP_Query loop. Eg. <img src=”https://wordpress.stackexchange.com/questions/61017/<?php wp_get_attachment_url( get_post_thumbnail_id() ); ?>” alt=”the-alt-tag” data-caption=”#htmlCaption-<?php $slider_query->current_post; ?>” /> Update – Untested but it should work. Make sure you turn on WordPress … Read more
correct me if I’m wrong but isn’t image.jpg , your original always the largest? — if not you can split the urls on ‘-‘. and get last from your sort? do take in mind you take last split, because it’s possible your filename has a ‘-‘. http://be.php.net/preg_split
i’m not sure about this one, but i think you have too many nested arrays. you should be getting something like [meta_query] => Array ( [relation] => OR [0] => Array ( [key] => _cmb_tuesday_location_1 [value] => huntley [compare] => LIKE ) [1] => Array ( [key] => _cmb_tuesday_location_2 [value] => huntley [compare] => LIKE … Read more
The latest term means it’ll have the highest term_ID right, So we’re sorting terms in DESC order and getting first array element of the result in $latest_mailer variable. Here’s code to do that, not tested but if didn’t worked – you can modify get_terms() function to return term with higest id. $mailer = get_terms(‘mailers’,’orderby=id&order=DESC&number=1′); $latest_mailer … Read more