difference between methods of query
query_posts() is just a wrapper for WP_Query that sets the $wp_query global.
query_posts() is just a wrapper for WP_Query that sets the $wp_query global.
You can use the has_tag function in a conditional statement to achieve what you want. Take a look at the codex page here: Function Reference/has tag. This isn’t 100% tailored to your specific question, but you should see how it’s working and adjust for your specific task: <?php if( has_tag() ) { ?> <?php query_posts( … Read more
If I understand your question correctly, you try to just get the children and ignore the parent. Dont know where post_child => 0 comes from but I’d use post_parent => $parent_id instead. In that case you have to catch the parent ID before you do any new queries. If you do something like this at … Read more
You can’t query the database for a value in the array. However you can grab the entire array and parse the array to get your value. Check out PHP ARRAY-VALUES. More than likely you’ll need to use a for each statement. Does the value your trying to get appear in the same spot in the … Read more
Sorry! Turns out the problem with query_posts failing here was due to my PHP memory_limit. I changed it from 8mb to 128mb and the problem goes away.
Modify your query and use the SQL alias as: $my_row = $wpdb_c->get_results(“SELECT Employee.Name as Employe_Name, Area.Name as Area_Name, Area.Region as Area_Region FROM Area INNER JOIN Employee ON Area.ID = Employee.Area_ID WHERE Employee.ID = ” . get_the_ID()); Then in your code use: $my_row[0]->Area_Name
Some things to check. Have permissions changed during your migration? Sometimes those things change unexpectedly. Use Chrome inspector to see if any Javascript is failing to load (look for the red x). Have you updated permalinks? Is your new dedicated environment able to support the requirements of everything you’re running? If your code hasn’t changed, … Read more
Well since nobody helped with at first look such an easy problem, i used my way, and if somebody will need it here it is: I used this query: $results = $wpdb->get_results( $wpdb->prepare( “select $wpdb->posts.ID, $wpdb->posts.post_status, $wpdb->posts.post_parent from $wpdb->posts where post_title like ‘%%%s%%’ and (post_type=”albumas” OR post_mime_type=”audio/mpeg”) AND (post_status=”inherit” OR post_status=”publish”) $excludes limit 0,”.$setting->limit, ($setting->search_content … Read more
To insert new code you need to break php code and past your new html+/-php code. But pay attention that after passing all will have correct syntax. Your question should be made like this: <?php $my_query = new WP_Query( “cat=11&posts_per_page=1” ); if ( $my_query->have_posts() ) { while ( $my_query->have_posts() ) { $my_query->the_post(); ?> <h2><a href=”https://wordpress.stackexchange.com/questions/53008/<?php … Read more
Modify the query_orderby clause to order by day of month. Add this to your anniversary_user_query function: $query->query_orderby = “ORDER BY DAY( $wpdb->usermeta.meta_value ) ASC”;