• I have to be honest I am really unsure how to debug this one. My site (www.waihekelocal.co.nz/accommodation) was working fine but I have recently discovered that sub categories are now no longer displaying and a 404 error page is served. All pages, post entries and parent categories are working fine. It is only the sub category pages that are affected.

    I am trying to rack my brain as to what changes I have made other then create new pages, css tweaks and add new post entries. Like I said all was working fine..so something has clearly gone wrong.

    Can anyone please help me…or at least point me in the right direction as to why this may have happened as I am stumped.

    Thanks so much
    Paul

Viewing 11 replies - 1 through 11 (of 11 total)
  • Can share code of category listing here?

    Thread Starter creative_lounge

    (@creative_lounge)

    Thanks..This is the category code for accommodation. I am sure though the code will be OK..as it was working fine. I am wondering if third party plugin is to blame here. De-activating but still no luck

    <section class="contentWrapper">
    		<span id="bc">You are here:</span>
    		<?php if ( function_exists('yoast_breadcrumb') ) {
    			yoast_breadcrumb('<p id="breadcrumbs">','</p>');
    		} ?>
    
    		<?php if(is_category(array(20,18,21,22,19,23))){ ?>
    		<h1>Stay <span>- <?php echo single_cat_title() ?> Accommodation</span></h1>
    		<?php } else { ?>
    		<h1>Stay <span>- Waiheke Accommodation</span></h1>
    		<?php }?>
    
    			<div class="clear"></div>
    		<?php
    		$categories = get_the_category();
    		foreach ($categories as $cat) {
     		}
    		$category = get_category($cat);
    		if ($category->cat_ID) {
    			if($category->category_parent)
    				$children = wp_list_categories('hide_empty=0&orderby=name&child_of=' . $category->category_parent . '&title_li=&echo=0');
    				else $children = wp_list_categories("orderby=name&hide_empty=0&title_li=&child_of=".$category->cat_ID."&echo=0");
    				$children = str_replace('<li>No categories</li>', '', $children);
    		}?>
    				<nav class="sub_nav">
    					<ul>
    						<?php echo $children ?>
    					</ul>
    				</nav>	
    
    		<?php $catID = get_query_var('cat'); ?>
    
    		<aside id="intro">
    			<?php echo category_description( $catID ); ?>
    		</aside>
    
    		<div class="clear"></div>
    
    		<section class="article_wrapper">			
    
    			<?php
    				$featured = new wp_query();
    				$featured->query('cat=' . $catID . '&showposts=1&orderby=rand');
    
    					while($featured->have_posts()) : $featured->the_post();
    						$wp_query->in_the_loop = true;
    						$featured_ID = $post->ID; ?>
    						<article class="feature">
    							<h2>Feature</h2>
    							<figure>
    								<?php $imgrow = 1; ?>
    								<?php while(the_repeater_field('images')): ?>
    									<?php if($imgrow == 1) { ?>
    										<a href="<?php the_permalink(); ?>"><img src="<?php the_sub_field('image'); ?>" alt="<?php the_title(); ?>"/></a>
    										<caption></caption>
    									<?php } ++$imgrow; ?>
    								<?php endwhile; ?>
    							</figure>
    							<div class="articleContent">
    								<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
    								<p><?php custom_excerpt(60); ?>
    							<footer>
    								<p><strong>Tagged: </strong><?php echo get_the_category_list(__( ' ', '' )); ?><?php the_tags('', '', ''); ?></p>
    							</footer>
    							</div>
    
    							<?php endwhile; ?>
    						</article>
    
    		<div class="clear"></div>	
    
    		<!-- Google Sub Header Menu -->
    		<div class="googleSubAds">
    			<ul>
    
    			</ul>
    		</div>
    		<!-- end -->
    
    		<?php $i = 1 ?>
    		<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    			<article class="listing captionfull<?php if($i == 3) echo " last";  ?>">
    				<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
    				<figure>
    				<?php $imgrow = 1; ?>
    					<?php while(the_repeater_field('images')): ?>
    						<?php if($imgrow == 1) { ?>
    							<a href="<?php the_permalink(); ?>"><img src="<?php the_sub_field('image'); ?>" alt="<?php the_title(); ?>" /></a>
    							<caption></caption>
    						<?php } ++$imgrow; ?>
    					<?php endwhile; ?>
    				</figure>
    
    				<div class="articleContent">
    					<p><?php custom_excerpt(12); ?>
    				</div>
    			</article>
    			<?php if($i == 3){
    			$i = 1;
    			} else {$i++;}
    			?>
    			<?PHP endwhile ?>
    		</section><!--end of article_wrapper-->
    			<?php else: ?>
    				<div class='noListings'>
    					<h2><?php _e('Sorry, there are currently no listings under this section. We actively working on this..come back again soon.'); ?></h2>
    				</div>
    			<?php endif; ?>
    			<?php
    			    global $wp_query;
    			    $total_pages = $wp_query->max_num_pages;
    			    if ($total_pages > 1){
    			      $current_page = max(1, get_query_var('paged'));
    			      echo '<div class="page_nav">';
    			      echo paginate_links(array(
    			          'base' => get_pagenum_link(1) . '%_%',
    			          'format' => 'page/%#%',
    			          'current' => $current_page,
    			          'total' => $total_pages,
    			          'prev_text' => 'Prev',
    			          'next_text' => 'Next'
    			        ));
    			      echo '</div>';
    			    }
    			?>
    			<div class="googleFooterBanner">
    			</div>
    			<?php get_footer(); ?>
    	</section><!--end of content Wrapper-->

    Sub categories (Which are in wrap between black background in footer just above the logo) not working on any page.

    So please share our footer code.

    Thread Starter creative_lounge

    (@creative_lounge)

    Thanks for looking into this for me @chandanonline4u.
    Perhaps rather lazily the footer are a series of hard-coded links that point to the category url in question e.g. <li><a href="<?php bloginfo('url'); ?>/accommodation/backpackers-budget/">Backpackers & Budget</a></li>

    Thanks

    I assume you are using /%category%/%postname% as custom structure and using . as category base? If so, subcategories will not work.

    I’m not quite sure why. It seems categories permalinks conflicts. If you change your custom structure to /%category%/%postname%.html and still use . as category base, then the subcategories will work. The only difference is that all posts will have .html in the url. But all pages/posts/categories will work.

    Thread Starter creative_lounge

    (@creative_lounge)

    All sorted now thanks chandanonline4u for looking into this it was a but strange, but like most wp issues it was a plugin that was screwing up the categories. Got a bit scary…just glad all is fixed.

    Thanks
    Paul

    Thread Starter creative_lounge

    (@creative_lounge)

    Thank you for looking into my issue codingpet.com I appreciate it. All sorted now.

    @creative_lounge, you are welcome.

    Can you please let me know how you make it domain.com/category/subcategory? Via plugin or by permalink custom structures and category base?

    When using /%category%/%postname% as custom structure and using . as category base, the issue is 100% the same as yours. So I’m interested in how you configured the permalink.

    Thread Starter creative_lounge

    (@creative_lounge)

    This topic is resolved

    Thread Starter creative_lounge

    (@creative_lounge)

    @codingpet.com

    To answer your question I don’t use a plugin for the permalink though Yoast SEO is removing the category base. My permalink setting is as you stated /%category%/%postname%/

    I think looking back when developing the site I was also having issues with using . as the category base. So it was convenient that Yoast SEO was able to handle that one for me instead.

    Cheers
    Paul

    @creative_lounge

    Things are clear now. Thank you.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Can Anyone Please help..Sub Categories now not displaying’ is closed to new replies.