Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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..

<?php
$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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.