Where to add offset?

<?php $recent = new WP_Query( array( ‘tag’ => get_option(‘gd_slider_tags’), ‘posts_per_page’ => get_option(‘gd_slider_num’), ‘offset’ => 1) ); while($recent->have_posts()) : $recent->the_post();?>

Display only a single CPT

You must ensure that the post type is registered with has_archive property set to true Look at codex example, replace ‘Books’ with ‘Products’ function codex_custom_init() { $labels = array( ‘name’ => ‘Books’, ‘singular_name’ => ‘Book’, ‘add_new’ => ‘Add New’, ‘add_new_item’ => ‘Add New Book’, ‘edit_item’ => ‘Edit Book’, ‘new_item’ => ‘New Book’, ‘all_items’ => ‘All … Read more

Loop not showing first post

It looks OK to me. There is nothing wrong with this part of your code. Maybe some earlier part is doing something strange with your $wp_query variable. You can try to add rewind_posts() before your loop – it should help. Just place rewind_posts(); just before if (have_posts())….

pre_get_posts works in post type archive but not in single post

The next_post_link() and previous_post_link() functions do not use the same query that ‘pre_get_posts’ affects. They use their own custom queries. You have to use other filters to affect them. Utimately, the get_adjacent_post() function does the bulk of the work for the next_post_link() and previous_post_link() functions. Here is part of that function: $adjacent = $previous ? … Read more

How come this loop is not working? [closed]

try this <div class=”container”> <div class=”inner_box”> <ul> <?php while ( have_posts() ) : the_post(); ?> <li> <?php the_title(); ?> <?php the_content(); //this is not in inner_box ?> </li> <?php endwhile; ?> </ul> </div> </div> try this <div class=”container”> <ul> <?php while ( have_posts() ) : the_post(); ?> <li> <div class=”inner_box”> <?php the_title(); ?> <?php the_content(); … Read more

Exceprt not displaying

According to your question: What is the main reason of loop? the clearest answer comes from official documentation: The Loop is PHP code used by WordPress to display posts. Using The Loop, WordPress processes each post to be displayed on the current page, and formats it according to how it matches specified criteria within The … Read more

Offset WP_Query by negative 1

I couldn’t understand your question. exactly Do you want next, prev post pagination? or You want to see next and prev posts titles or other content? Actually you placed an incorrect value to offset. You have to do something like this. // Initialize where to start the post from, 0 is most recent post $init_count … Read more

excerpt not showing up

Inside a template file, the standard loop syntax will display only the information about that page( In fact, a template file is no more than a page ). If you want to display some posts you need to run a custom query or to include ( get_template_part() ) another template file which normally runs a … Read more