• vaflex

    (@vaflex)


    URL: https://www.vaflex.com/shop

    Issue: Not all called pages displaying at the bottom of the page, which is using the WyntonMagazine theme’s Section Page Template

    First up, thanks to Michael for an awesome base theme to work with.

    I’ve used a couple of Michael’s tutorials to get me started, and beyond that I’m really pleased that, being fairly new to PHP, I’ve been able to work nearly everything out on my own… but I just can’t seem to find the answer to this problem!

    I want to link to pages instead of posts on a page using the Section Page Template but I can only get the first page to appear where it should.

    The original code was:

    <?php // "Section headlines" module begins
    query_posts('showposts=5&cat=30&offset=1'); ?>

    I used JamesVL’s guide and changed it to:

    <?php // "Section headlines" module begins
    query_posts('showpages=9&page_id=486,493,495,498,500,502,477,504&offset=1'); ?>

    Can someone possibly help me out with what I’m doing wrong here? Any help much appreciated!

Viewing 5 replies - 1 through 5 (of 5 total)
  • MichaelH

    (@michaelh)

    Try adding &post_type=page to the argument list

    query_posts() has a more update list of parameters.

    Thread Starter vaflex

    (@vaflex)

    Thanks Michael, I’ve tried it a few different ways without any effect. Does it matter what order the arguments are in?

    I now have:

    <?php // "Section headlines" module begins
    query_posts('showpages=8&page_id=486,493,495,498,500,502,477,504&offset=1&post_type=page'); ?>

    with the same issue. I can’t work out why it’s not working.

    MichaelH

    (@michaelh)

    What do you get without the page_id clause:

    query_posts('showpages=8&offset=1&post_type=page');
    MichaelH

    (@michaelh)

    Actually that code look redundant. Try this:

    <?php
    $args = array(
      'post_type' => 'page',
      'post__in' => array(486,493,495,498,500,502,477,504),
      'offset' => 0
      );
    $pages = get_posts($args);
    $out='';
    if ($pages) {
      foreach($pages as $page) {
        $out .= '<li>';
        $out .=  '<a href="'.get_permalink($page->ID).'" title="'.wptexturize($page->post_title).'">'.wptexturize($page->post_title).'</a></li>';
      }
      $out = '<ul class="page_post">' . $out . '</ul>';
      echo $out;
    }
    ?>

    Thread Starter vaflex

    (@vaflex)

    Michael, thanks, you are being amazingly helpful. This works in bringing it up as a list but the idea of this page template is to bring it up in a certain type of display. You can see how it’s supposed to look here (the group of posts with square pics at the bottom of the page).

    In case it helps, here is the full page code (I have deliberately commented out some of the bits I don’t want to use):

    <?php
    /*
    Template Name: Section Page
    */
    ?>
    <?php get_header(); ?>
    
    <div id="section-content">
      <div id="section-teaser">
        <?php // "Section teaser" module begins
    	query_posts('showposts=1&page_id=698'); ?>
        <?php while (have_posts()) : the_post(); ?>
     <!--   <small class="commentmetadata">
        <?php _e('By','wyntonmagazine');?>
        <?php the_author_posts_link('namefl'); ?>
        |
        <?php the_time(__ ('F jS, Y', 'wyntonmagazine'));?>
        |
        <?php _e('Category:','wyntonmagazine');?>
        <?php the_category(', ');?>
        |
        <?php comments_popup_link(__ ('No Comments »', 'wyntonmagazine'), __ ('1 Comment »', 'wyntonmagazine'), __ngettext ('% comment', '% comments', get_comments_number (),'wyntonmagazine')); ?>
        <?php edit_post_link('Edit', ' | ', ' | '); ?>
    -->
        </small> <a href="<?php the_permalink() ?>" rel="bookmark" class="section-title">
        <?php
    // this is where title of the article gets printed
    	  the_title(); ?>
        </a><br />
            <?php
    // this grabs the image filename
    	$values = get_post_custom_values("section-teaser-image");
    // this checks to see if an image file exists
    	if (isset($values[0])) {
    ?>
        <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img class="left" src="<?php bloginfo('url'); echo '/'; echo get_option('upload_path'); echo '/'; $values = get_post_custom_values("section-teaser-image"); echo $values[0]; ?>" alt="image" /></a>
        <?php } ?>
    
        <?php the_excerpt(); ?>
    
    <!--    <div class="section-read-on">
        <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php _e('[ See More... ]','wyntonmagazine');?></a>
        </div>
    -->
        <?php endwhile; ?>
      </div>
      <div id="section-articlelist">
    
    <?php // "Section headlines" module begins
    query_posts('showpages=8&page_id=486,493,495,498,500,502,477,504&offset=1&post_type=page'); ?>
    
        <?php while (have_posts()) : the_post(); ?>
        <?php
    // this grabs the image filename
    	$values = get_post_custom_values("section-category-image");
    // this checks to see if an image file exists
    	if (isset($values[0])) {
    ?>
        <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img class="left" src="<?php bloginfo('url'); echo '/'; echo get_option('upload_path'); echo '/'; $values = get_post_custom_values("section-category-image"); echo $values[0]; ?>" alt="image" /></a>
        <?php } ?>
    <!--    <small class="commentmetadata">
        <?php _e('By','wyntonmagazine');?>
        <?php the_author_posts_link('namefl'); ?>
        |
        <?php the_time(__ ('F jS, Y', 'wyntonmagazine'));?>
        |
        <?php _e('Category:','wyntonmagazine');?>
        <?php the_category(', ');?>
        |
        <?php comments_popup_link(__ ('No Comments »', 'wyntonmagazine'), __ ('1 Comment »', 'wyntonmagazine'), __ngettext ('% comment', '% comments', get_comments_number (),'wyntonmagazine')); ?>
        <?php edit_post_link('Edit', ' | ', ' | '); ?>
        </small>
    -->
    
    <a href="<?php the_permalink() ?>" rel="bookmark" class="section-subtitle">
        <?php
    // this is where title of the article gets printed
    	  the_title(); ?>
        </a><br />
        <div class="section-p"><?php the_excerpt(); ?></div>
        <?php endwhile; ?>
      </div>
    </div>
    
    <?php get_sidebar(); ?>
    
    <div class="clear"></div>
    <?php get_footer(); ?>
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Using query to bring up Pages’ is closed to new replies.