• Resolved guidotti

    (@guidotti)


    Hi,

    Relatively new to reading php so I’m sure this will be obvious to someone with more experience. From the home page of my site none of the filtering options such as categories, tags, author, or archives are working. The title will display correctly but the related posts are not displayed, instead all the posts are display in order of post date no matter what. http://sketchyday.com/

    Any advice would be helpful, I’ve been trying to solve this one myself for months.

Viewing 7 replies - 1 through 7 (of 7 total)
  • does the theme have an archive.php?

    if not, does index.php contain a custom query?

    Thread Starter guidotti

    (@guidotti)

    the theme does not have an archive.php in the index.php there is a query for archive

    <?php get_header(); global $more; ?>
    
    			<div class="container">
    				<div class="page-title">
    					<?php if(is_search()) { ?>
    						<h2><?php /* Search Count */ $allsearch = &new WP_Query("s=$s&showposts=-1"); $count = $allsearch->post_count; echo $count . ' '; wp_reset_query(); ?><?php _e('Search results for','slate'); ?> "<?php the_search_query() ?>" </h2>
    					<?php } else if(is_tag()) { ?>
    						<h2><?php _e('Tag','slate'); ?>: <?php single_tag_title(); ?></h2>
    					<?php } else if(is_day()) { ?>
    						<h2> <?php _e('Archive','slate'); ?>: <?php echo get_the_date(); ?></h2>
    					<?php } else if(is_month()) { ?>
    						<h2><?php _e('Archive','slate'); ?>: <?php echo get_the_date('F Y'); ?></h2>
    					<?php } else if(is_year()) { ?>
    						<h2><?php _e('Archive','slate'); ?>: <?php echo get_the_date('Y'); ?></h2>
    					<?php } else if(is_404()) { ?>
    						<h2><?php _e('404 - Page Note Found','slate'); ?></h2>
    					<?php } else if(is_category()) { ?>
    						<h2><?php _e('Category','slate'); ?>: <?php single_cat_title(); ?></h2>
    					<?php } else if(is_author()) { ?>
    						<h2><?php _e('Posts by Author','slate'); ?>: <?php the_author_posts(); ?> <?php _e('posts by','slate'); ?> <?php
    						$curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author)); echo $curauth->nickname; ?></h2>
    					<?php } ?>
    				</div>

    do you usually keep following a problem for months 🙂
    don’t mind but if i was you i would have tried to get rid by installing another theme.

    in the index.php there is a query for archive

    the posted part does not contain a query, like some code with query_posts();
    please paste the full code of index.php into a http://pastebin.com/ and post the link to it here – http://codex.wordpress.org/Forum_Welcome#Posting_Code

    Thread Starter guidotti

    (@guidotti)

    Here is the full index.php, thanks for your help. http://pastebin.com/UXmkPaYJ

    this is the custom query I was asking for, and which makes every archive page look like the index page:

    <?php query_posts( array( 'cat' => $blogcat, 'paged' => get_query_var('paged') ) ); ?>

    do you remember why this was added?

    if this is to control the front page posts, try to wrap it into a conditional statement, so the query is only used in the posts page/front page;
    for instance:

    <?php if( is_home() ) {  query_posts( array( 'cat' => $blogcat, 'paged' => get_query_var('paged') ) ); }  ?>

    http://codex.wordpress.org/Function_Reference/is_home

    Thread Starter guidotti

    (@guidotti)

    Eep! that is great! That query is an unnecessary bit, which I’ve removed, placing the site it working order. If it does become necessary I’ll use the conditional bit as you suggested. Thank you so much for taking the time!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘category, author, archives and tags not looping’ is closed to new replies.