WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Page not showing "page content", but most recent blog post (17 posts)

  1. oldwebgeek
    Member
    Posted 7 years ago #

    I've recently setup and installed WP 2.04 and verified that mod_rewrite works and .htaccess is writeable (chmod 666). My blog post permalinks work just fine. However, when I create a new WP Page using the page template, the content that appears on the page is actually the most recent blog post, not the Page content.

  2. Samuel B
    moderator
    Posted 7 years ago #

    A link to your site would be useful.

  3. oldwebgeek
    Member
    Posted 7 years ago #

    My aplogies:

    URL to blog home page:
    http://wtamm.no200.nononsensehosting.net/

    URL of the test page that shows the blog post instead of page content:
    http://wtamm.no200.nononsensehosting.net/first-test-page/

  4. Samuel B
    moderator
    Posted 7 years ago #

    Nice site.
    I don't have any idea. What happens when you edit the "page"?
    Also what is the post slug for that page?

  5. oldwebgeek
    Member
    Posted 7 years ago #

    When I edit the page, I can see the Page's content in the text editor just fine. The post slug is automatically created by WP when the Page is first created.

    It's when I attempt to view the Page, using the URL created by WP, that I see the Page load with the most recent post instead of the Page content.

  6. oldwebgeek
    Member
    Posted 7 years ago #

    UPDATE: I double-checked the .htaccess file and it never gets updated by WP whenever a new page is created. I verified that it is write-able so I'm really not sure how to solve this problem.

    Any assistance would be greatly appreciated.

  7. oldwebgeek
    Member
    Posted 7 years ago #

    UPDATE II: Even when trying to access the Page with permalinks turned off (using the ?page_id= parameter), the content that displays on the Page is still the most recent Post, not the Page's content.

  8. oldwebgeek
    Member
    Posted 7 years ago #

    The page content shows up properly using the WP default and classic themes.

    I compared the Page template code from my themes page to that of the other themes and they are identical. Every major template tag is present in my Page theme including the Loop.

    Can someone please help, I really need to get this problem solved!

  9. tsguitar
    Member
    Posted 7 years ago #

    Have you turned off all plugins?

    If it works in default and classic themes, it sounds like this is a theme conflict. Have you tried other themes?

    Finally, using something like pastebin, can you post your page template?

  10. oldwebgeek
    Member
    Posted 7 years ago #

    No I haven't turned off all the plugins because only the default ones are running.

    If I switch to either the classic or default themes, the Page content shows up on a Page just fine.

    However, using my theme (including page.php) a Page will load showing the most recent Post, not the Page content that I typed into the editor.

    I'll try the pastebin site and see if I can't paste the template here.

  11. oldwebgeek
    Member
    Posted 7 years ago #

    <?php<br>
    /*<br>
    Template Name: Web Page<br>
    */<br>
    ?>
    <?php get_header(); ?>
    <div id="content">
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div id="page-<?php the_ID(); ?>"><br>
    <br>
    <h1><?php the_title(); ?></h1><br>
    <?php the_content('Read the rest of this page &raquo;'); ?><br>
    <br>
    <?php link_pages('Pages: ', '', 'number'); ?><br>
    <br>
    <?php endwhile; endif; ?><br>
    <br>
    <?php edit_post_link('Edit this entry.', '', ''); ?><br>
    <br>
    </div>
    </div>
    <?php get_footer(); ?>

  12. oldwebgeek
    Member
    Posted 7 years ago #

    Nevermind the "<br>" tags, they were added when I posted to this forum.

  13. sporock
    Member
    Posted 7 years ago #

    I am having the exact same problem. I cant view any of my content pages, only posts.

    Anyone have any luck resolving this?

  14. Joshua Sigar
    Member
    Posted 7 years ago #

    If it happens only to your theme, may be you could zip it up and make it available for download so that someone could debug it with their wp installation.

  15. oldwebgeek
    Member
    Posted 7 years ago #

    Download the theme for debugging.

  16. bcwood
    Member
    Posted 7 years ago #

    I was having the same problem, and just managed to fix it. It looks like you are doing the same thing I was. In your sidebar.php file, you are displaying a list of your most recent posts by calling $posts = get_posts(). The variable $posts is used by the WordPress loop, so using it here messes up the main loop.

    All I had to do to fix this problem was to rename this variable (I changed mine to $recent_posts). Hopefully this fixes your problem as well.

  17. oldwebgeek
    Member
    Posted 7 years ago #

    bewood:

    That solved the problem perfectly, thank you very much!

Topic Closed

This topic has been closed to new replies.

About this Topic