Incorrect posts displayed on category page

I’m using this loop to show my 5 latest posts but even if I’m selecting a category it still shows the 5 latest posts from all category. query_posts(‘showposts=5’); <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <h1><a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title(); ?></a></h1> <h4>Posted on <?php the_time(‘F jS, … Read more

How much worse is querying custom fields compared to custom taxonomies, quantitatively

OK, I know (because i’ve read it many times) why custom fields is less efficient than custom taxonomies when it comes to querying/filtering posts, but just how inefficient is it by comparison? I’d love some researched quantitative statistics to back this up. What sort of number of posts and custom fields are we talking about … Read more

query_posts different amount of posts per page [duplicate]

This question already has an answer here: Changing Posts Per Page and offset with pre_get_posts (1 answer) Closed 6 years ago. I have a posts_per_page query to paginate multiple post types, which works great! Now though, as it paginates it to show (in this case) 100 posts per page, I’m wondering if you can show … Read more

Getting taxonomies specific to categories

I have categories set up for car manufacturers. I have 4 custom taxonomies that are also set up: color, starburst, offer_type, and logo_count. Each post I upload to my wordpress has values for all 4 of those taxonomies and is assigned a category. I have a custom page template setup to display all posts that … Read more

How do I find the first item in the post array?

I left ????? where I need the answer. <?php global $post; $the_post_ID = $post->ID; $n = get_posts(); ?> <?php foreach ( $n as $post ) : ?> <nav id=”postNav”> <ul> <li<?php if (?????) echo ‘ class=”current”‘; ?>> <a href=”<?php the_permalink(); ?>” title=”<?php printf( esc_attr__( ‘Permalink to %s’, ‘twentyten`enter code here`’ ), the_title_attribute( ‘echo=0’ ) ); … Read more

Limitless amount of posts in custom archive page

I want to get rid of pagination completely on my custom archive, I want everything on 1 page. How can I do this? Currently I’m getting my posts with: <?php query_posts($query_string . ‘&orderby=title&order=ASC’); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> The codex pages on query_posts and pagination don’t seem much help, they’re … Read more

Browser Cache causes ‘Orderby=rand’ to return the same posts

I have a code that redirects users to a random post whenever they visit the homepage: if (have_posts()) { query_posts(‘orderby=rand’); while (have_posts()) { the_post(); wp_redirect(get_permalink()); } } The problem is that it redirects me to the same post whenever I’m not logged in. I suspect W3 Total Cache is the culprit as it puts logged … Read more

show custom post’s post in two different divs [duplicate]

This question already has answers here: How can I loop into two different DIVS without repeating the DIVs (4 answers) Closed 7 years ago. I have created a custom post type. For that I have used this code add_action( ‘init’, ‘broker_post_type’ ); function broker_post_type() { register_post_type( ‘new_broker’, array( ‘labels’ => array( ‘name’ => __( ‘Brands’ … Read more