Forums

Need help getting blog page to show (13 posts)

  1. tjesker
    Member
    Posted 2 years ago #

    I just set up this site in WordPress http://idwdesign.biz/blackburn/wordpress and everything works great except the blog page. I want the blog to show up using the same navigation and heading as the rest of the site so I made a blank blog page and under settings -> reading set the posts page to that page (called "blog"). I did not set the front page here as I customized it by editing index.php.

    I also made a custom template (page_blog.php) and set the page "blog" to use that as it's template. Here is the loop I set up inside the template to display the blog. Can someone tell me what I'm doing wrong" Nothing displays. (If I click "View" from one of the posts though, I see the post but it's inside a messed up version of my homepage that is not using the custom template - e.g. http://idwdesign.biz/blackburn/wordpress/archives/679 )

    <div class="art-content">
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<div class="art-Post">
        			<div class="art-Post-body">
    				<div class="art-Post-inner art-article">
    
    					<!-- Page Title -->
    					<h2 class="art-PostHeader-page">
    						<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'kubrick'), the_title_attribute('echo=0')); ?>">
    							<?php the_title(); ?>
    						</a>
    					</h2>
    					<!-- Page Text -->
    					<div class="art-PostContent">
       					<?php the_content(); ?>
    					</div>
    					<div class="cleared"></div>
    				</div>
    				<div class="cleared"></div>
       		      </div>
    		</div>
    		<?php endwhile; endif; ?>
          </div>
  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    I did not set the front page here as I customized it by editing index.php

    I think that's where your problem is. Your "posts page" uses index.php as it's template.

  3. tjesker
    Member
    Posted 2 years ago #

    Thanks for your reply. It does look like the posts page is using index.php as it's template - at least when I click "view" to preview posts, but how do I get it to use page_blog.php? I went into the page "blog" that I have set to be the blog page and set the template to page_blog.php.

  4. tjesker
    Member
    Posted 2 years ago #

    Update. I changed the permalink structure from /archives/%post_id% to /%postname% and now when I click on "view" under one of the posts the page doesn't have a messed up sidebar (see http://idwdesign.biz/blackburn/wordpress/christmas-and-technicolor). But http://idwdesign.biz/blackburn/wordpress/blog just shows the homepage with no blog text so it seems to still be using index.php for the template instead of page_blog.php even though I have specified that template in the page called "blog." Can anyone suggest what I might need to do? Thanks!

  5. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    it seems to still be using index.php for the template instead of page_blog.php even though I have specified that template in the page called "blog."

    Sorry - perhaps I wasn't clear enough. That's how WordPress works when you specify a posts page. You can't override it with a page template. What I would do is copy the custom index.php file and turn it into a custom page template. Then I'd reinstate the theme's original index.php file and tweak it to incorporate the custom code from your original page_blog.php. Finally, I'd set up a static Home page with the Blog page as the posts page.

  6. tjesker
    Member
    Posted 2 years ago #

    Thanks again for your help. I did exactly what you said and it almost works: http://idwdesign.biz/blackburn/wordpress/blog shows the latest blog post with index.php customized the way I want it. But when I click on a link for an archived post e.g. http://idwdesign.biz/blackburn/wordpress/2009/11 the page looks different and apparently uses something other than index.php as it's template. Can you tell me how to get the archived pages to also use index.php - or else help me figure out what template page they are using? I can't seem to figure that out.

  7. sathishn
    Member
    Posted 2 years ago #

    Archives use archive.php in themes. So changing the style of that will help you

  8. henkholland
    Member
    Posted 2 years ago #

  9. tjesker
    Member
    Posted 2 years ago #

    Thanks sathishn and henkholland. The Info from both of you was very helpful and got me closer to getting this how I want it. One last related question. When a post is viewed via the single.php template the comments form looks different than it does when I look at the same post via the archive.php or index.php templates. I noticed that single.php uses:

    <?php comments_template(); ?>

    to display the comment form but the templates archive.php and index.php use:

    <?php include (TEMPLATEPATH . '/comments.php'); ?>

    to display the comment form.

    I tried inserting

    <?php comments_template(); ?>

    into index.php and archive.php instead but nothing shows up on the comment form. Any idea what I need to do to get it to display?

    I like how it displays in single.php ( http://idwdesign.biz/blackburn/wordpress/christmas-and-technicolor )

    rather than the other way like here http://idwdesign.biz/blackburn/wordpress/blog

  10. henkholland
    Member
    Posted 2 years ago #

    Tjesker, I am not using comments so I am not familiar with these commands.
    Search the codex and look here:
    http://codex.wordpress.org/Include_Tags nr 4 and 5 in this doc.

  11. tjesker
    Member
    Posted 2 years ago #

    Thanks again kenholland. Looks like #4 on the link above has the solution:

    "To display comments on the main index or archive pages, you'll need to set the $withcomments variable to "1" before calling this tag. "

    I cannot find the file where the the $withcomments variable is saved though. Any idea what file I need to edit?

  12. sathishn
    Member
    Posted 2 years ago #

    You may put it on index.php to show comments there.

  13. tjesker
    Member
    Posted 2 years ago #

    I tried putting this at the top of index.php but it had no effect:

    <?php $withcomments = 1; ?>

    Okay for now I'm just going to settle for having a different comments form show depending on how people access a post. I'll check back later and see if anyone can tell me how to get the same comments form to show on index.php and archive.php as shows on single.php.

Topic Closed

This topic has been closed to new replies.

About this Topic