Pagination on custom post type on front-page.php

The root problem here is the call to query_posts: $args = array(‘post_type’ => array(‘posts’, ‘affiliate-products’)); query_posts($args); At no point do you tell it which page to fetch, so it always fetches the first page, aka the default. You could add this, but fundamentally, the entire approach is incorrect, and has many other problems you might … Read more

How to display first post

Calling the_post() is what advances the internal current_post counter that have_posts() checks the value of within the loop. With this in mind, you can call the_post() once outside the loop and use any template tags you wish, then run the loop as normal and it will pick up and continue from the second post. the_post(); … Read more

Include future posts in tags and in search

To achieve the intended result you will have to modify the query by adding the future value to the post_status parameter via the pre_get_posts filter hook. add_action( ‘pre_get_posts’, ‘se338152_future_post_tag_and_search’ ); function se338152_future_post_tag_and_search( $query ) { // apply changes only for search and tag archive if ( ! ( $query->is_main_query() && (is_tag() || is_search()) ) ) … Read more

Pagination broken after using 2 loops to show content

So here is my attempt at it…though I don’t really have a good place to test it on my end, but I think it should work. (Fingers Crossed) <?php // First Page of Pagination – https://codex.wordpress.org/Function_Reference/is_paged if(!is_paged()){ $first_page = true; $query_args = array( ‘posts_per_page’ => ’11’, ); } else { $query_args = array( ‘posts_per_page’ => … Read more

How to get user ID’s from multiple usernames?

Your call to get_user_by() has a small hiccup in it. It needs to be login rather than user_login // Search these Usernames $usernames = array(‘user1’, ‘user2’); // Fetch the User IDs $prof_ids = array(); foreach ($usernames as $prof_id) { $user = get_user_by(‘login’, $prof_id); $prof_ids[] = $user->ID; } // WP_User_Query arguments $args = array( ‘include’ => … Read more

Yoast taking over my WordPress title tag [closed]

That’s not what the SEO title does/is for. It appears that you’ve used the wp_title() function in your template by mistake. wp_title() is intended for use in the <title> tag in the <head> for setting the browser tab/document title. However, since WordPress 4.1 this has been superseded (but not officially deprecated, yet) by add_theme_support( ‘title-tag’ … Read more

Loop is crazy – one row displays wrong count of posts [closed]

For your clearfix wrapper you are doing it wrong. You have this: $counter = 0; while ( $loop->have_posts() ) : $loop->the_post(); if ($counter % 4 == 0) : echo $counter > 0 ? “</div>” : “”; // close div if it’s not the first echo “<div class=”clearfix”>”; endif; // BUILDS INTERNAL DIVS $counter++; endwhile; So … Read more