WordPress.org

Ready to get started?Download WordPress

Forums

blog function not working (6 posts)

  1. graham85
    Member
    Posted 1 year ago #

    hi ive built my own theme from scratch and the blog function isnt working.
    my blog page doesn't pull all my posts in excerpt snippets the page just remains blank. does any1 know the the php code or loop to amend this.
    thanks in advance

  2. Rev. Voodoo
    Volunteer Moderator
    Posted 1 year ago #

    http://codex.wordpress.org/The_Loop
    http://codex.wordpress.org/The_Loop_in_Action

    It's hard to be more specific without knowing what you've done so far...

  3. graham85
    Member
    Posted 1 year ago #

    ive cretated a seperate template for the blog roll. ive use this code so far but it doesnt display the post execerpts.

    [please mark any posted code - see http://codex.wordpress.org/Forum_Welcome#Posting_Code ]

    <?php get_header(); ?>
    
    <?php if (have_posts()) : ?>
    
      <?php if (($wp_query->post_count) > 1) : ?>
         <?php while (have_posts()) : the_post(); ?>
           <!-- Do your post header stuff here for excerpts-->
              <?php the_excerpt() ?>
           <!-- Do your post footer stuff here for excerpts-->
         <?php endwhile; ?>
    
      <?php else : ?>
    
         <?php while (have_posts()) : the_post(); ?>
           <!-- Do your post header stuff here for single post-->
              <?php the_content() ?>
           <!-- Do your post footer stuff here for single post-->
         <?php endwhile; ?>
    
      <?php endif; ?>
    
    <?php else : ?>
         <!-- Stuff to do if there are no posts-->
    
    <?php endif; ?>
    
    <?php get_footer(); ?>
  4. Rev. Voodoo
    Volunteer Moderator
    Posted 1 year ago #

    Is that your index.php? Are you using the default setup for your blog, as in it is the main page, or do you have another page set to be your blog page, with a static front page?

    It is important to understand your setup, and file naming to be able to troubleshoot.

  5. graham85
    Member
    Posted 1 year ago #

    the blog page has its own blog.php page
    my index.php is my frontpage its static and has is_frontpage(); code in it

  6. Rev. Voodoo
    Volunteer Moderator
    Posted 1 year ago #

    http://codex.wordpress.org/Template_Hierarchy

    Are you sure the proper template is loading?

    I'm pretty sure blog.php isn't in the naming conventions

    WP doesn't look for a file named blog.php, so it's probably trying to use index.php to display your blog posts

    I'm not 100%, but front-page.php would probably be a good choice for a static front page, and will always load for it, then index.php would be utilized for blog posts.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags