Ascending & descending posts on same page with IF statement

You can’t change the DESC to ASC “within the IF statement”. The query has already ran at that point. I don’t really understand what the code is meant to do though. I don’t really see that code ever producing the pattern you describe. Specifically, I don’t understand what the shortcode strings or for or how … Read more

Admin Post List table Query filtering “WHERE” for custom post type

Awesome. This works! Thanks @Milo /*Change results based on the current user’s role and status */ function posts_for_current_role($query) { global $pagenow; if( ‘edit.php’ != $pagenow || !$query->is_admin ) return $query; if( current_user_can(‘editor’)): //Add query where clause to status equals “working”. $query->set( ‘post_status’, array( ‘working’, ‘draft’ ) ); endif; if( current_user_can(‘administrator’)): $query->set( ‘post_status’, array( ‘published’) ); … Read more

update $wpdb one query

Try removing the $wpdb->prepare. $wpdb->query(“UPDATE wp_postmeta SET meta_value = meta_value – 1 WHERE post_id= 9999 AND meta_key = ‘point_user'”);

Can I create my own query in wordpress with traditional methods?

With some assistance from @JacobPeattie I modified the code to the recommended get_tags() function. Now in the functions.php I have the following code. // Get al the tags with published post function get_all_tags(){ $posttags = get_tags(”); if ($posttags) { foreach($posttags as $tag) { echo ‘<li><a href=”#”>’.$tag->name.'</a></li>’; } } } In the single.php file, I call … Read more

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