treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Wordpress posts showing up in all pages, why?

  • I was just going through the theme I'm building and noticed that the pages I made aren't showing the content posted in that page, all that shows up are the posts that are created. How come it's doing this and how do I get the content from the page to show up instead of the posts?
  • Please post the code you have in your page.php
  • sorry, reposted the code so it will show properly
  • <?php get_header(); ?>

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

    <div id="content_wrap">

    <div id="content_main">
    <h2><?php the_title(); ?></h2>
    <?php the_content(''); ?>
    </div><!----- End Of Content_Main ----->

    </div><!----- End Of Content_Wrap ---->


    <?php endwhile; ?>
    <?php endelse: ?>
    <?php endif; ?>

    <?php get_footer(); ?>
  • Hmmmm, nothing looks out of order for me there. Try replacing the_title with some random text. This will make sure that your pages are using the proper template.
  • maybe I'll just remake it from scratch. I'm using Ambers hijinks wordpress template.
  • Hi, thanks in advance for any help. I'm having this same problem. My posts are showing up on all pages when I want them to show up only on the home page. I've designated "latest posts" for "front page displays" in settings>reading but the content from my pages doesn't show up, the one blog post shows up on all pages. Any ideas how to fix?

    Here is the link to a page; http://hollyraschein.com/wordpress/about/
    Here is the code from my page.php;
    <?php<br />/*
    Template Name: Page
    */
    ?>
    <?php get_header(); ?>
    <?php get_sidebar(); ?>

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

    <?php the_title(); ?>



    <?php the_content(); ?>
    <?php wp_link_pages(array('before' => 'Pages: ', 'next_or_number' => 'number')); ?>

    <?php edit_post_link('Edit this entry.', '<p>', ''); ?>

    <?php endwhile; endif; ?>

    <?php get_footer(); ?>
  • ugh, i can't even copy and paste my code here for some reason, its copying tweaky...guess its time for bed.
  • ok one last try...
    <?php<br />/*
    Template Name: Page
    */
    ?>

    <?php get_header(); ?>

    <?php get_sidebar(); ?>

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

    ">

    <?php the_title(); ?>







    <?php the_content(); ?>

    <?php wp_link_pages(array('before' => 'Pages: ', 'next_or_number' => 'number')); ?>



    <?php edit_post_link('Edit this entry.', '<p>', ''); ?>





    <?php endwhile; endif; ?>


    <?php get_footer(); ?>
  • In my main index template(index.php) I had this where I wanted my posts to appear.


    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    <h1><?php the_title(''); ?></h1>
    <?php the_content(''); ?>
    <?php endwhile; endif; ?>


    That fixed everything for me, so my posts would show up on my main home page and then on my pages it would show the page content I had.

    Don't forget to place it in your page.php template also. Let me know if it works.