• Hello all,
    I’m using a simple horizontal theme, which places posts of different categories horizontally on a page through a series of WP_Query()s

    Everything works fine on a local MAMP server, but when live online, certain categories aren’t showing on the front page, even tho they exist.

    The site is live at: elliejones.co.uk

    Once a post is viewed (of category production) then all content is displayed. I do not believe it is a browser-specific issue.

    So it seems various have_posts() queries are falsely returning ‘false’, but only on the home page.

    Ideally of course, I’d like to resolve why this: has anyone had a similar experience/ or have any suggestions as to how to go about debugging?

    A hack work-around would be to redirect the home page to one of the production posts – but I can’t do this via .htaccess as this will mess wp-admin access. Any other options?

    WP is set to load most recent posts, rather than a static page.

    I include the index.php file which implements this.

    Many thanks in advance for any ideas.

    Alice

    <?php get_header(); ?>
    
    <div id="wrapper">
    
    <div id="home" class="section-holder">
    
    <div class="section">
    
    </div> <!-- div.section -->
    </div> <!-- home div.section-holder -->
    
    <!-- any code included here occurs before the wordpress loop and is always displayed -->
    
    <!-- GO THROUGH MULTIPLE LOOPS -->
    <!-- //////////////////////////////////////  ////////////////////////////////////// -->
    
    <!-- PUT THE ABOUT PAGE -->
    
    <?php $about_query = new WP_Query('pagename=about'); ?>
    	<div id="about" class="section-holder" >
        <div class = " section">
        <div id = "about-holder" class = "drag">
        <div id = "about-text">	
    
     <?php if ($about_query->have_posts()) : while ($about_query->have_posts()) : $about_query->the_post();?>
        <!-- put the about page... -->
    		<h2><?php the_title(); ?></h2>
    		<p><?php the_content(); ?></p>
      <?php endwhile;  
    
      else : ?>
    	<h3>About</h3>
    	<p>Sorry, I don't know anything about Ellie Jones. Please come back soon</p>
    
    <?php endif; ?>
    
    	</div> <!-- about text-->
    	</div> <!-- about holder-->
    	</div> <!-- section-->
    	</div> <!-- section-holder-->
    
    <!-- PUT THE PRODUCTIONS LIST  -->
    
    <?php $productionsList_query = new WP_Query('category_name=productions'); ?>
        <div id="productions" class="section-holder" >
    	<div class = "section">
    	<div id = "productions-menu-holder" >
    	<div id = "productions-menu">
    
    	<h2>Productions (Past, Present & Future)</h2>
    	<br>
    	<p>[click production name for info and reviews]</p>
    	<ul>
      <?php while ($productionsList_query->have_posts()) : $productionsList_query->the_post();
      $posttags = get_the_tags();
    
    	if ($posttags) {
      		foreach($posttags as $tag) {
      		  $rever = $tag->name;}
    	}?>
    
    	<li><?php the_date( 'Y', '<yr>', '</yr>'); ?> &nbsp &nbsp<a href="<?php the_permalink(); ?>#productions" ><?php the_title('', ''); ?></a> -  <?php echo $rever ?></li>
    
      <?php endwhile; ?>
    </ul>
    	</div> <!-- menu-->
    	</div> <!-- menu holder-->
    	</div> <!-- section-->
    	</div> <!-- section-holder-->
    
    <?php query_posts($query_string . '&cat=12&posts_per_page=1');
      	if (have_posts()) : ?>
    		<div id="reviews-contents" class="section-holder" >
    		<div class = "section">
    		<div id = "reviews-list">
    
    	<?php while (have_posts()) : the_post(); ?>
    		<div class = "reviews-item">
    		<a name = "#<?php the_title(); ?>-menu"></a>
    		<h2><?php the_title(); ?></h2>
    		<p><?php the_content(); ?></p>
    		</div> <!-- item -->
    
      <?php endwhile;  ?>
    
    	</div> <!-- list-->
    	</div> <!-- section-->
    	</div> <!-- section-holder-->
    
      <!-- PUT THE NEWS -->
    
    <?php $news_query = new WP_Query('category_name=news'); ?>
        <div id="news" class="section-holder" >
    	<div class = "section">
    	<div id = "news-list">
    	<h2>News</h2>
    	<div id="newsslider">
    
      <?php while ($news_query->have_posts()) : $news_query->the_post();?>
    
    	<div class = "news-item">
    		<h3><?php the_title(); ?></h3>
    		<?php the_date('Y-m-d', '<h4>', '</h4>'); ?>
    		<p><?php the_content(); ?></p>
    
    		<div id="fb-root"></div>
    		<!--
    	<script src="https://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="<?php echo get_permalink(); ?>" show_faces="false" action="recommend" width="350"></fb:like>
    -->
    
    <a name="fb_share" type="button_count" href="https://www.facebook.com/sharer.php">Share</a><script src="https://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
    
    	</div> <!-- item -->
    
      <?php endwhile; ?>
      	</div> <!-- slider-->
    	</div> <!-- list-->
    	</div> <!-- section-->
    	</div> <!-- section-holder-->
    
    <!-- PUT THE GALLERY -->
    
    <?php $gallery_query = new WP_Query('category_name=gallery');  ?>
    
        <div id="gallery" class="section-holder" >
    	<div class = "section">
    	<h3 class = "rot-2"> Gallery</h3>
    	<div class="gallery ">
    
      	<?php if ($gallery_query->have_posts()) : while ($gallery_query->have_posts()) : $gallery_query->the_post(); ?>
    
    	<?php the_content();?>
    
      	<?php endwhile;
      	else : ?>
      	<p>Very sorry, but there are no pictures here </p>
    	<?php endif; ?>
    
    	</div> <!-- photos-->
    	</div> <!-- section-->
    	</div> <!-- section-holder-->
    
    	<!-- PUT THE AUDIO --->
    
    	<?php $audio_query = new WP_Query('pagename=listen'); ?>
    
    	<div id="audio" class="section-holder" >
    
    	<div class = "section">
    
    	<div id = "audio-holder rot-1">
    	 	<?php while ($audio_query->have_posts()) : $audio_query->the_post();?>
    		<h3>Listen</h3>
    
        <div class = "player">
    		<p><?php the_content(); ?></p>
    
    	</div> <!-- the player -->
      		<?php endwhile;  ?>
    
    	</div> <!-- holder-->
    	</div> <!-- section-->
    	</div> <!-- section-holder-->
    
    	<!-- PUT THE VIDEO  -->
    
    <?php $video_query = new WP_Query('category_name=video');  ?>
    
        <div id="video" class="section-holder" >
      	<div class = "section">
    	<h3 class = "rot-1"> Video</h3>
    	<div id = "video-holder">
    
      	<?php if ($video_query->have_posts()) : while ($video_query->have_posts()) : $video_query->the_post(); ?>
    
    	<div class="video-item" >
    
    	<?php the_content(); ?>
    
    	</div>
    
      	<?php endwhile;
      	else : ?>
    
      	<div class="video-item">
      	<p>Very sorry, but there are no flims to watch </p>
      	</div> <!-- item -->
    
    	<?php endif; ?>
    	</div> <!-- vid holder -->
    
    	</div> <!-- section-->
    	</div> <!-- section-holder-->
    
    <div id="contact" class="section-holder" >
    <div class = "section">
    <h3>Contact</h3>
    <div id = "contact-info" >
    
     <?php
    
    // PUT CONTACT PAGE
    $page_id = get_page_by_title('Contact');
    $page_data = get_page($page_id);?>
    
    <?php echo apply_filters('the_content', $page_data->post_content); ?> 
    
    </div> <!-- list -->
    </div> <!-- div.section -->
    </div> <!-- div.section-holder -->
    
    	<!-- stop the post loop and process any code included here only once
    	// any code output will be displayed below the entire set of posts -->
    
    <?php else : ?>
    
    sorry there is nothing to display
    <!-- if there are no posts to display, process any code that is included here
    	// the output of any code included here will be displayed instead of posts -->
    
    <?php endif; ?>
    
    <!--any code included here occurs after the wordpress loop and is always displayed -->
    
    <div id="sidebar" class = "section-holder ">
    
    <div class = "section">
    
    <div id = "sidebar-holder" >
    <h3>Links</h3>
    <?php get_sidebar(); ?>
    <div id = "footer">
    <?php get_footer(); ?>
    </div>
    </div>
    </div>
    </div>
    
    </div><!--/wrapper-->
  • The topic ‘Posts not showing on front page – queries not working’ is closed to new replies.