How to Make infinite loop of post

A very basic example, $args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => -1 ); $query= new WP_Query($args); while ( $query->have_posts() ) : $query->the_post(); the_content(); //example, use whatever template functions you like… endwhile; wp_reset_postdata(); //reset Post Data wp_reset_query(); //destroy query incase of using multiple queries on same page Important: Note, that this is probably an inefficient … Read more

get_pagination not working on a custom post type query (using WP_Query)

Pagination is only built “well” in non-custom post-types. Below, I’ll post an article with more detail about the more complex setup required for custom post-type pagination via the WP_Query() method. But to give the direct answer to your question, it’s not working because get_pagination() is not a method that belongs to the WP_Query() object, rather … Read more

Featured Image or Post Thumbnail Displaying on index.php?

WordPress will never use single.php to render the site front page. Refer to the Template Hierarchy for Site Front Page: front-page.php Static page hierarchy: $custom-template.php, page-$slug.php, page.php Blog posts index hierarchy: home.php index.php Ensure that you are calling body_class() inside of the HTML <body> tag, and provide a live link to your site, and we … Read more

Problem with different query loops (and “main loop”) on category template page!

In order to provide more-specific help, we’ll need to know greater detail regarding exactly what’s happening that you don’t expect, or what’s not happening that you expect to happen, or what is happening differently from what you expect. That said, there are at least two things that will likely help you: Use descriptive and unique … Read more

How do I remove a category from a wordpress loop>

You can add category id or category slug into arguments you are passing to query_posts: <?php // category slug (‘products’) query_posts(array( ‘post_type’ => ‘post’, ‘showposts’ => 5, ‘category_name’ => ‘products’ ) ); ?> or <?php // category id (‘3’) query_posts(array( ‘post_type’ => ‘post’, ‘showposts’ => 5, ‘cat’ => ‘3’ ) ); ?> In the second … Read more

Trying to get variables in hacked category dropdown

The dot . in your code is evaluated as string litral, and not concatenation. Meaning if $inpCnt was equal to 5 for example, php will search for name=”scrape[“.5.’][sponsors]’ id= and will fail to find it. You can either remove the dots while still using the double quotes: $sponsors = str_replace( “name=”scrape[“$inpCnt’][sponsors]’ id=”, “name=”scrape[“$inpCnt’][sponsors][]’ multiple=”multiple” size=”19″ … Read more