• Scott B.

    (@scott-b-1)


    I’m use this template file it displays the same content on the pages that use the file. I’m didn’t write the code and am fairly new to PHP. Can someone please tell me what I need to remove or add in order to make this work.

    <?php
    /**
     * Template Name: OurWork Internal Pages
     */
    
    get_header(); ?>
    <div id="content">
    			<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    	        <article class="post clearfix">
                <header>
                <h1 class="blog-title">Our Work</h1>
                </header>
    
                <?php
                $child_pages = $wpdb->get_results("SELECT *    FROM $wpdb->posts WHERE post_parent = ".$post->post_parent."    AND post_type = 'page' ORDER BY menu_order", 'OBJECT');    ?>
                <?php if ( $child_pages ){?>
                <ul class="child-pages">
    			<?php foreach ( $child_pages as $pageChild ) : setup_postdata( $pageChild );
    			$class= "";
    			if($pageChild->ID==$post->ID)
    				$class = "class='current-menu-item-parent'";
    			else
    				$class = "";
    			?>
                <li <?php echo $class;?>>
                <?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?>
                <?php
    				$title = $pageChild->post_title;
    			?>
                <a href="<?php echo  get_permalink($pageChild->ID); ?>" rel="bookmark" title="<?php echo $pageChild->post_title; ?>"><?php echo $title; ?></a>
                </li>
                <?php endforeach;?>
                </ul>
                <div class="clear"></div>
    
                <?php }?>
    
                <h1 class="page-title"><?php the_title();?></h1>
                <?php the_content(); ?>
                </article>
        	        <!-- /.post -->
    			<?php endwhile?>
                <div class="clearfix"></div>
    </div>
    <!-- /#content -->
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    I would really appreciate any help.

    Thanks,
    Scott

Viewing 3 replies - 1 through 3 (of 3 total)
  • Chip Bennett

    (@chipbennett)

    What (in human terms) are you wanting to display with this template file?

    Thread Starter Scott B.

    (@scott-b-1)

    content from posts. the problem is it displays the same content on all new pages that use the template. The only thing that changes is the title.

    Chip Bennett

    (@chipbennett)

    content from posts

    Content from what specific posts?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Pages displaying same content’ is closed to new replies.