Trying to WP_Query a category

You are using WP_Query incorrectly: you need to be calling the have_posts() and the_post() functions as methods of your $query variable: <?php if (have_posts()) : while (have_posts()) : the_post(); ?> Becomes: <?php if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?> You should also call wp_reset_postdata(); after the query loop is finished. … Read more

Next and Previous buttons are not showing on home page for post

like @Mayeennul said you have your templates mixed up. Generally speaking the home page contains a list of excerpts the_excerpt() with links to individual blog posts that are displayed using single.php. If you want a single blog post as your home page you could copy single.php and rename it to index.php or front-page.php.

how to add limit records in wordpress query

What you want to do, can be achieved by means of the WP_Query class. $query = new WP_Query(array( ‘post_type’ => ‘quote2’, ‘posts_per_page’ => 10, // or something else )); Now you can work with $query like: if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post; ?> <h1><?php the_title(); </h1> <?php the_content(); <?php } else { // No … Read more

Get posts after calculating meta key

Assuming meta_count is another column in your postmeta table below query should get you the posts based on meta_value/meta_count calculation. $postids=$wpdb->get_col( $wpdb->prepare( “SELECT post_id FROM $wpdb->postmeta ORDER BY (meta_value/meta_count) LIMIT 10 ” ) ); The result $postids would be an array. You will have to declare $wpdb as a global variable before you use this … Read more

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