WordPress loop: Display if posts exist

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

Retrieving custom field array value through db query

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

WP_Query orderby meta key/value suddely stopped working

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

SQL: Search query to get attachments only of those parents which are published

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

How can I add more code to this?

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 Global Posts Plugin

Can you use the SQL OFFSET statement: OFFSET 1 $query = “SELECT * FROM ” . $wpdb->base_prefix . “site_posts WHERE blog_public=”1″ AND post_type=”” . $recentglobalpoststype . “” ORDER BY post_published_stamp OFFSET 1 DESC LIMIT ” . $recentglobalpostsnumber;

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)