WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create a slider where you choose what pages are shown in the slider, using a theme options panel based on the https://github.com/vauvarin/options-framework-theme

That lists the pages in the options like so..

$options[] = array( "name" => "Slider One Page",
                                        "desc" => "Choose page for first slide.",
                                        "id" => "slide_page1",
                                        "type" => "select",
                                        "options" => $options_pages);

To display that page id in the theme page i use..

<?php echo of_get_option('slide_page1'); ?>

So how do in corporate that page id into a query to display the pages content?

Is it possible?

Thanks for any help.

share|improve this question

Figured it out myself, for anyone else that needs help here are the two options..

            <!--Method 1-->

        <?php $query = new WP_Query(); $query->query('post_type=page&p=' . of_get_option('slide_page1'));while ($query->have_posts()) : $query->the_post(); ?>

        <?php the_title(); ?>

        <?php endwhile; wp_reset_query(); ?>        

        <!--Method 2-->

            <?php $slide1 = of_get_option('slide_page1');?>

        <?php $loop = new WP_Query( array('p' => $slide1, 'post_type' => array('post', 'page'), )); ?>

        <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>

        <h3>    <?php the_title(); ?></h3>

        <?php endwhile; wp_reset_query(); ?>
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.