WordPress.org

Ready to get started?Download WordPress

Forums

Call pages instead pages (5 posts)

  1. pedroooo
    Member
    Posted 3 years ago #

    Hi folks,

    Can anyone tell me how i call pages instead from posts? I have this code in my wordpress.
    Any expert?

    <div id="accordian" ><!--Parent of the Accordion-->
    
    <?php $i = 3; if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    <!--Start of each accordion item-->
      <div id="test<?php if ($i != 1) { echo $i-1; } ?>-header" class="accordion_headings<?php if ($i == 1)  ?>" ><?php the_title(); ?></div><!--Heading of the accordion ( clicked to show n hide ) -->
    
      <!--Prefix of heading (the DIV above this) and content (the DIV below this) to be same... eg. foo-header & foo-content-->
    
      <div id="test<?php if ($i != 1) { echo $i-1; } ?>-content"><!--DIV which show/hide on click of header-->
    
          <!--This DIV is for inline styling like padding...-->
        <div class="accordion_child">
            <?php the_content(''); ?>
        </div>
  2. esmi
    Forum Moderator
    Posted 3 years ago #

  3. pedroooo
    Member
    Posted 3 years ago #

    esmi

    i dont understand what i have to change in the script.

    Can you light me up?

  4. pedroooo
    Member
    Posted 3 years ago #

    Done. Resolve what i ask.
    But know i have another problem. i can't put posts in a page like a page with "News".

    I still want use the posts..
    anyone?

  5. gotmedia
    Member
    Posted 3 years ago #

    If anybody's wondering, here's the fix:

    query_posts( array( 'post_type' => array('page', 'movie') ) );

    Add that before this:

    <?php $i = 3; if (have_posts()) : while (have_posts()) : the_post(); ?>

    Full Example:

    <?php query_posts( array( 'post_type' => array('page', 'movie') ) ); $i = 1; if (have_posts()) : while (have_posts()) : the_post(); ?>

    It worked out great!

Topic Closed

This topic has been closed to new replies.

About this Topic