Word Press Blog loop goes away when I pick a static front page

Posted on 2007-10-09
Medium Priority
Last Modified: 2008-03-03
am having a wordpress issue.  I installed the newest version 2.3.  I also uploaded a theme - cutline.  
I added some new pages such as about, services, portfolio, and a page I named home.
In options, reading - I changed things to use a static page as the "front page", and I picked the one i named home to be the front page.

So here is my issue.  I renamed the one that had said Front Page to blog.

If I keep the option for a static front page, the blog link becomes identical (or actually is) the "home" page with no entries for a blog.  If I uncheck that option, then the blog link (and page)  displays blog entries.

Here is where my changes were made, inside of header.php - for display of the menu on top.  These changes were made in addition to making the changes in the admin area for a static home page.    I hope someone can help me out!!

<ul id="nav">
        <li><a <?php if (is_page('home')) echo('class="current" '); ?>href="<?php bloginfo('url'); ?>/home/">home</a></li>
            <li><a <?php if (is_page('about')) echo('class="current" '); ?>href="<?php bloginfo('url'); ?>/about/">about</a></li>
        <li><a <?php if (is_page('services')) echo('class="current" '); ?>href="<?php bloginfo('url'); ?>/services/">services</a></li>
        <li><a <?php if (is_page('portfolio')) echo('class="current" '); ?>href="<?php bloginfo('url'); ?>/portfolio/">portfolio</a></li>
        <li><a <?php if (is_page('contact')) echo('class="current" '); ?>href="<?php bloginfo('url'); ?>/contact/">contact</a></li>
        <li><a <?php if (is_home()) echo('class="current" '); ?>href="<?php bloginfo('url'); ?>">blog</a></li>
            <li class="rss"><a href="<?php bloginfo('rss2_url'); ?>">RSS</a></li>
Question by:linque
  • 5
  • 4
LVL 13

Accepted Solution

MasonWolf earned 2000 total points
ID: 20051147
I think I can see what you were trying to do. The idea is clever - basically build a website in Wordpress, where the blog is not the left-hand link in the homepage, thereby minimizing its significance to the site. Wordpress does allow you to do this, but it's not intuitive.

First, reload your original header, but remove this line (or it's equivalent in your theme):
<li <?php if(is_home()){echo 'class="current_page_item"';}?>><a href="<?php bloginfo('siteurl'); ?>" title="Home">Home</a></li>

Next, create an empty page from the "Write Page" menu and name it "Blog". In the right-hand list of options, give it a category slug of "blog" and a page order of 1 (this moves it to the right-hand side of your links).

To make sure that your new static "home" page appears to the left of the other links, give it a page order of -1. You can do this by edit that page through the manage tab.

In the Options tab, click the "Reading" submenu and choose the option to make a static page your homepage. Select the "home" page for your front page, and select the empty "blog" page your posts page.

Next go to the Permalinks submenu (also under Options) and select the custom option for your permalink structure. Type "/%postname%" in that input field. Hopefully that'll accomplish what you wanted.

If that still doesn't work, you may need to enable mod_rewrite for your server. If you run Apache I may even be able to walk you through that. If you run IIS, there's a plugin you can install on your blog to make it work.

Author Comment

ID: 20051941
IT WORKED!!!!!!!!


But I just discovered something about this.  I added a new post, and when I click the blog link (I added a new one to my list in the header now that's
  <li><a <?php if (is_page('blog')) echo('class="current" '); ?>href="<?php bloginfo('url'); ?>/blog/">blog</a></li>

in order to have a link at the top

Now older posts show up, but I just added one, it took the tile as a slug, and it does not show up with the older posts.  It's "published" - and it is available at www.mydomain.com/new-post/ 
but it's not available when I simply click "blog" at the top..   hmmmm  

p.s.  I also updated the .htaccess when I changed the permalinks as I was instructed to do.
LVL 13

Expert Comment

ID: 20052060
I don't know why that would happen. I tested the same approach on my own blog and the new post showed up fine. However, I did not manually add the blog page to my header file. I wonder if this function from the original header actually updated the page before displaying:
<?php wp_list_pages('title_li=&depth=1');?>

Try doing what I recommended earlier and reload your original header file. Just take out that one line that creates a link to your homepage. See if that fixes it for you.
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.


Author Comment

ID: 20052412
Hi MasonWolf,

I took the line out.  When I surf to my site www.mydomain.com/blog/ I'm still not seeing any new posts.  Of interest, as well..  
when I  open the existing page above, I see one of the 2 original posts on the blog.  at the top, there is a "breadcrumb" sort of thing.  It says "2nd post".  If I click it, I get the 2nd post, but the breadcrumb thing now shows two other *pages* going forward or back - which happen to be "services" or "interiors" - I'm not sure what the implications of this are.   Maybe I need to start all over??
LVL 13

Expert Comment

ID: 20052552
Just so I understand you, you're saying that you did reload your original header first?

What's your actual URL so I can see what you're describing?

Author Comment

ID: 20052725
http:// www oscar hertz interiors . com   (no spaces)

Author Comment

ID: 20052734
oh - yes - i reloaded the header.php without the line, as you had suggested
LVL 13

Expert Comment

ID: 20052890
I think what happened is that you have your first post's slug set to "blog". Since both the blog page and the first blog post are being returned when WP retrieves content from the database, it's just a question of which result comes back first. If that's right, then it's simply that the post came back first and so that's what your link brought back. As for the screwy navigation links from the second post, I'm really not sure what would cause that.

Anyway, the solution, I think, is to revise your permalinks. Try using "/%postname%/%post_id". If I was right about the problem, that should fix it for you. This will make sure that even if you have multiple items mapping to the same %postname% value, you won't have ambiguity in your link destination.

Author Comment

ID: 20052957
I went to your profile, and sent a message from your info there.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month13 days, 23 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question