• Resolved nessler

    (@nessler)


    I have installed a blog, it’s use is to replace the old news page on my already existing webpage. So I made a news.php, where the blog is read.

    https://www.fortherestless.com/news.php

    To make us of the loop and the query, I altered the index.php file in the theme folder that I am using, using this wordpress guide.
    https://codex.www.ads-software.com/Template_Tags/query_posts#Example_2

    However, upon uploading the thing the blog doesn’t show anything, simply blank.
    Can anyone show me where I went wrong ?

    <?php get_header(); ?>
      <div id="bd" class="yui-navset">
    
        <div id="yui-main">
    		<div class="yui-b" >
    			<div class="yui-g">
    
    <?php
    
    // The Query
    $the_query = new WP_Query( $args );
    $current_year = date('Y');
    query_posts( "cat=22&year=$current_year&order=ASC" );
    ?>
    
    	<?php if (have_posts()) : ?>
    
    		<?php while (have_posts()) : the_post(); ?>
    <!-- item -->
    				<div class="item entry" id="post-<?php the_ID(); ?>">
    				          <div class="itemhead">
    				            <h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
    				            <div class="chronodata"><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></div>
    				          </div>
    						  <div class="storycontent">
    								<?php the_content('Read more &raquo;'); ?>
    						  </div>
    				 </div>
    <!-- end item -->
    
    <?php comments_template(); // Get wp-comments.php template ?>
    
    		<?php endwhile; ?>
    
    	<?php endif; ?>
    <!-- end content -->
    <!-- 2nd sidebar -->
    
    <!-- end 2nd sidebar -->
    			</div>
    		</div>
    	</div>
    	<div class="yui-b" id="secondary">
    
    <?php get_sidebar(); ?>
    
    	</div>
      </div>
    <?php get_footer(); ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    Do you have any post in category ’22’?
    change this:

    // The Query
    $the_query = new WP_Query( $args );
    $current_year = date('Y');
    query_posts( "cat=22&year=$current_year&order=ASC" );

    to this:

    // The Query
    $current_year = date('Y');
    query_posts( "year=$current_year&order=ASC" );

    to see if you only get posts from this year

    Thread Starter nessler

    (@nessler)

    so simple that one couldn’t see it…

    THANK YOU !

    It works like a charm now, never thought I’d get through this since I only started using wordpress not even a week ago.

    Cheers !

    Moderator keesiemeijer

    (@keesiemeijer)

    You’re welcome.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Problem: posts made this year in blog won't show’ is closed to new replies.