A search for ‘0’ returns results

Considering @Mayeenul Islam comment: I’ve just tested in a blank theme with dummy data, search with 0 (zero) fired an empty search – that means all: SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.post_type IN (‘post’, ‘page’, ‘attachment’) AND (wp_posts.post_status=”publish”) ORDER BY wp_posts.post_date DESC LIMIT 0, 10 and the fact that wp-includes/query.php contains if … Read more

WP_Query: Why is sticky post not first item in loop?

If you look ate the source code where stickies are included, we find the following condition before WP_Query carries on to include sticky posts if ( $this->is_home && $page <= 1 && is_array($sticky_posts) && !empty($sticky_posts) && !$q[‘ignore_sticky_posts’] ) { The big game player is the is_home condition. Conditionals inside WP_Query is set according to the … Read more

Should I use loop in the single.php file?

Stricktly speaking, you don’t need the loop in single post pages, you only need the call to the_post(). The reason for the_post() is that the_post() sets the $post global value to the single post post object

Get 10 posts from a WP_Query. If less than 10, get the remainder from elsewhere

You could do something like : $related_posts_query = new WP_Query( $related_posts_args ); if( $related_posts_query->found_posts < 10 ){ $args = array(/* new wp_query args*/); $newquery = new WP_Query( $args ); } # merge the two results $related_posts_query->posts = array_merge( $related_posts_query->posts, $newquery->posts ); $related_posts_query->post_count = count( $related_posts_query->posts ); # do your loop here

Ways to have multiple front-page.php templates that can be swapped out?

One way is to have a single front-page.php and then using get_template_part(), to show different content based on user choice. Rough code: get_header(); $layout = get_option( ‘front_page_layout’, ‘default’ ); get_template_part( ‘front-page’, $layout ); get_footer(); After that you need to create a file for every layout, they should be called, something like: front-page-one.php front-page-two.php front-page-three.php front-page-default.php … Read more

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