Support » Fixing WordPress » Can't Find Blog Posts. Not Sure Why

  • I’m trying to get a page to find the posts in all categories and list them on this page:

    Media Page

    As you can see the posts aren’t aren’t being looped and displayed.

    The code below is located in the blog.php page which I’ve chosen for the page template. It’s returning the else. Anyone know what I can do to get my posts to display here?

    Thanks.

    <?php
    /*
    Template Name: Blog
    */
    ?>

    <?php get_header(); ?>

    <div class=”break_alpha”></div>
    <div class=”break-a”></div>
    <div class=”break-b”></div>
    <div class=”break_gamma”></div>
    <!– page separate –>

    <div class=”grid_10 alpha”>
    <?php
    $in_news_cat = get_option(“in_news_cat”);
    $wp_query = new WP_Query(‘cat=-‘.get_cat_ID($in_news_cat).’&paged=’.$paged);
    ?>

    <?php if($wp_query->have_posts()) : while($wp_query->have_posts()) : $wp_query->the_post(); ?>

    <div class=”post” id=”post_<?php the_ID(); ?>”>
    <h3>“><?php the_title(); ?></h3>

    <?php if(has_post_thumbnail()) { ?>
    <img class=”img_wrp_c” src=”<?php tt_img_url($post->ID, 580, 220); ?>” alt=”<?php the_title(); ?>” />
    <div class=”break_alpha”></div>
    <?php } ?>

    <p><span class=”button_basic”><?php the_time(‘jS F Y’) ?></span> #comment-area”><?php comments_number(‘No Comments’,’1 Comment’,’% Comments’); ?></p>

    <div class=”entry”>
    <?php the_excerpt(); ?>
    </div>
    <p>“>Read More</p>
    </div>

    <div class=”break_gamma”></div>
    <!– .post –>

    <?php endwhile; else : ?>

    <div class=”post”>

    <h3>Page Not Found</h3>

    <p>Looks like the page you’re looking for isn’t here anymore. Try browsing the categories, archives, or using the search box below.</p>

    </div> <!– .post –>

    <?php endif; ?>

    <?php if(function_exists(‘wp_pagenavi’)) { wp_pagenavi(); } ?>

    </div>

    <div class=”grid_1″>
     
    </div>
    <!– end grid space –>

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

Viewing 11 replies - 1 through 11 (of 11 total)
  • How many categories do you currently have? Do you want the latest “x” number of excerpts from each category to display on the “Blog” page? And in what order? Alpha by category and then within that, chronologically, latest at top? Like this:

    APPLES
    10.07.2010 post title
    10.04.2010 post title
    10.03.2010 post title

    ORANGES
    10.02.2010 post title
    9.21.2010 post title

    PEARS
    10.09.2010 post title
    10.08.2010 post title
    10.01.2010 post title

    I am thinking a plugin might be your best bet, but let’s try the Codex first. I’ll see what I can find for you. Stand by.

    Just a list of the latest posts. From newest to oldest. 10 posts per page.

    Oh, so you don’t really need it organized by category then?

    To show the latest 10 posts from any category in reverse chrono order, use this code then:

    <?php query_posts(
                'showposts'=>10,
                'order'=>DESC)
    ); ?>
    
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    i’ll give it a try.

    This is now the code:

    <div class=”grid_10 alpha”>

    <?php query_posts(
    ‘showposts’=>10,
    ‘order’=>DESC)
    ); ?>

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    <h2 id=”post-<?php the_ID(); ?>”>
    ” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”>
    <?php the_title(); ?>
    </h2>
    <small><?php the_time(‘F jS, Y’) ?> <!– by <?php the_author() ?> –></small>

    <div class=”post” id=”post_<?php the_ID(); ?>”>
    <h3>“><?php the_title(); ?></h3>

    <?php if(has_post_thumbnail()) { ?>
    <img class=”img_wrp_c” src=”<?php tt_img_url($post->ID, 580, 220); ?>” alt=”<?php the_title(); ?>” />
    <div class=”break_alpha”></div>
    <?php } ?>

    <p><span class=”button_basic”><?php the_time(‘jS F Y’) ?></span> #comment-area”><?php comments_number(‘No Comments’,’1 Comment’,’% Comments’); ?></p>

    <div class=”entry”>
    <?php the_excerpt(); ?>
    </div>
    <p>“>Read More</p>
    </div>

    <div class=”break_gamma”></div>

    <?php endwhile; else : ?>

    <div class=”post”>

    <h3>Page Not Found</h3>

    <p>Looks like the page you’re looking for isn’t here anymore. Try browsing the categories, archives, or using the search box below.</p>

    </div> <!– .post –>

    <?php endif; ?>

    <?php if(function_exists(‘wp_pagenavi’)) { wp_pagenavi(); } ?>

    </div>

    I’m getting an error on the line that hold the <?php endwhile; else : ?>

    I would like them to post with the theme parameters and styles. Including the thumbnail image, read more button. The theme seemed to be broken and not returning the latest posts.

    Actually I uploaded the wrong blog.php from another directory. I’ve uploaded the new one with this code and there’s and error that reads:

    Parse error: syntax error, unexpected T_DOUBLE_ARROW in /home/suzukibullrun00/weinerttrainingfacility.com/wp-content/themes/incognito/blog.php on line 16

    line 16 is:

    <?php query_posts(‘showposts’=>10, ‘order’=>DESC)); ?>

    and the current code is:

    <div class=”grid_10 alpha”>
    <?php query_posts(‘showposts’=>10, ‘order’=>DESC)); ?>

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    <h2 id=”post-<?php the_ID(); ?>”>
    ” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”>
    <?php the_title(); ?>
    </h2>
    <small><?php the_time(‘F jS, Y’) ?> <!– by <?php the_author() ?> –></small>

    <div class=”post” id=”post_<?php the_ID(); ?>”>
    <h3>“><?php the_title(); ?></h3>

    <?php if(has_post_thumbnail()) { ?>
    <img class=”img_wrp_c” src=”<?php tt_img_url($post->ID, 580, 220); ?>” alt=”<?php the_title(); ?>” />
    <div class=”break_alpha”></div>
    <?php } ?>

    <p><span class=”button_basic”><?php the_time(‘jS F Y’) ?></span> #comment-area”><?php comments_number(‘No Comments’,’1 Comment’,’% Comments’); ?></p>

    <div class=”entry”>
    <?php the_excerpt(); ?>
    </div>
    <p>“>Read More</p>
    </div>

    <div class=”break_gamma”></div>
    <!– .post –>

    <?php endwhile; else : ?>

    <div class=”post”>

    <h3>Page Not Found</h3>

    <p>Looks like the page you’re looking for isn’t here anymore. Try browsing the categories, archives, or using the search box below.</p>

    </div> <!– .post –>

    <?php endif; ?>

    <?php if(function_exists(‘wp_pagenavi’)) { wp_pagenavi(); } ?>

    </div>

    <div class=”grid_1″>
     
    </div>

    Ahh. {{Slaps forehead}}

    Extra closing parenthesis there. Should be this; sorry; my fault!

    <?php query_posts(
                'showposts'=>10,
                'order'=>DESC
    ); ?>
    
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    I take full responsibility for any hair, fingernail or sanity loss! 😀

    Syntax error on line 17.

    line 17 is:

    ‘showposts’=>10,

    I used this line instead and it worked. Thanks for your efforts.

    <?php query_posts(
    ‘posts_per_page=7’
    ); ?>

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Can't Find Blog Posts. Not Sure Why’ is closed to new replies.