Results 1 to 3 of 3

Thread: calling different page content

  1. #1
    Mild Fuzz is offline Here For The Peanuts
    Join Date
    Feb 2010
    Posts
    106

    Default calling different page content

    is there a way to call the content from one page to another?

    I would like to make a 'super-descender' style page, with several pages worth of content descending down one page, but would like the content to be controlled like each section was a different page in the Admin area.

    Cheerts

  2. #2
    Rarst's Avatar
    Rarst is offline Big Tipper
    Join Date
    Jul 2009
    Posts
    322

    Default

    Well, you can code pretty much anything, question is how much of a hassle it would be against your goals.

    Roughly you can create page template that will query content from several other pages with get_posts() function and output it.
    Rarst.net - cynical thoughts on software and web (and sometimes WP) | @Rarst | I seem to be non-GPL-compliant person. Beware my poisonous thoughts.

  3. #3
    C3MDigital's Avatar
    C3MDigital is offline Hello World
    Join Date
    Mar 2010
    Location
    Houston, TX
    Posts
    45

    Default

    Like Rarst said you can query posts or pages in your page templates. I am currently working on a site that queries custom post types by taxonomy and I have one page that makes 8 queries. Here is an example of the code I am using:
    First the default loop to get the content entered on the page from the WP dashboard:
    Code:
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <div class="entry">
    <?php the_content(); ?>
    </div>
    </div>
    
    <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    </div>
             </div>
    <?php endif; ?>
    Next I query the custom post type with the custom "classification" taxonomy "vodka-gin":
    Code:
    <?php wp_reset_query(); ?>
    
    <?php query_posts( array( 'classification' => 'vodka-gin' ) ); ?>
    
     <h3>Vodka & Gin</h3>
     <ul class="product-listing">
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    <li><h4><?php the_title(); ?></h4>
    <span class="product-content"><?php the_post_thumbnail(); ?><?php the_content(); ?></span>
    </li>
    <?php endwhile; else: ?>
    <?php endif; ?>
    </ul>
    The above code is repeated for each custom classification.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •