Support » Themes and Templates » Including Sub-Pages as Blocks in my Template

  • I really need some help finding simplest, least invasive and/or “hackish” to solving this problem!

    I have a custom theme which includes a custom “Home Page” template, applied to the main page of my site.

    In the Home Page template, I need to display three (3) content blocks, which are actually 3 separate pages, using a custom “Section Block” template I’ve created.

    The Section Block template is designed to display the Page Title, Featured Image, and the first 300 characters or so of a Page’s content, in a simplified layout.

    What’s the best way to actually pull in these three pages and templates?

    Note: Bear in mind that when the user clicks a Section Block on the Home Page, it will take them to the regular content page, using a completely different, standard Page template!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Well, that helps a little.. it tells me how to retrieve a group of posts and iterate over them (I’m sure I can look further into WP_Query to get the pages I need):

    <?php
    $my_query = new WP_Query('category_name=featured&posts_per_page=1');
    while ($my_query->have_posts()) : $my_query->the_post();
      $do_not_duplicate = $post->ID;
      ?>
      <!-- Do stuff... -->
    <?php endwhile; ?>

    However, I’m still stuck on actually displaying them with my custom “block” template. I didn’t see anything in there about displaying posts with an explicit, alternate template?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Including Sub-Pages as Blocks in my Template’ is closed to new replies.