• I hope I can explain this well enough.

    I setup a page on my site that pulls in content from a page using a template I created called corporate_detail

    Here is the page: http://currentcorp.dreamhosters.com/?page_id=32

    I have a side bar (where it says seakeepers) but I have that content sitting in the actual template. I would like to have that content in a page so it can be easily edited rather then having to go into the template php file to edit that section. Is it possible to create a page for section and use code to pull it into the template?

    Can someone please explain how I can do this?

    Thank you for your help.

    Patty

Viewing 1 replies (of 1 total)
  • In your sidebar.php or a PHP code widget

    <?php
    $args=array(
      'page_id' => 7,
      'post_type' => 'page',
      'post_status' => 'publish',
      'posts_per_page' => 1,
      'caller_get_posts'=> 1
    );
    $my_query = null;
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
      echo 'List of Posts';
      while ($my_query->have_posts()) : $my_query->the_post(); ?>
        <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
        <?php
        the_content();
      endwhile;
    }
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>
Viewing 1 replies (of 1 total)

The topic ‘Pulling in content from a page.’ is closed to new replies.