Continuous listing from a custom field

First of all, please don’t use query_posts, but a new WP_Query. Outpu count based on page is just a matter of a simple arithmetic operation using current page number and posts per page number. global $wp_query; $paged = $wp_query->get(‘paged’) ? : 1; $posts_per_page = 10; // feel free to change this $args = array( ‘cat’ … Read more

Query posts from a specific category and selected tag

Since you’re working with the tag archive index page query, this really won’t be all that difficult. You simply need to filter the query parameters at pre_get_posts, using your criteria. For example: function wpse137627_pre_get_posts( $query ) { // If this is the tag archive index, // and is the main query if ( is_tag() && … Read more

Sort loop with query in the link

You could use rewrite rules but doing it the way you’ve put should be fine. It’s safe so long as you sanitize the query string. Using add_query_arg() you can add a query to the end of your current URL, like this: $link = add_query_arg( ‘orderby’, ‘name’, get_permalink() ); You can then, for example, apply it … Read more

Trying to exclude posts from a category on the home page

Technically, pre_get_posts is an action, not a filter, and you don’t need to return anything and $query is passed in by reference, but that code should nonetheless work. Cleaned up it would be: function excludeCat($query) { if ( $query->is_home ) { $catid = get_cat_ID(‘watch-isatv’); $query->set(‘cat’, ‘-‘.$catid); } } add_action(‘pre_get_posts’, ‘excludeCat’); There are several potential points … Read more

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