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

Im creating a theme which have a custom setting page. I know the best method to choose a static page is by going to Settings -> Reading, but my client wants to have all in the same place.

I already got the dropdowns on the settings page and i did the front page by creating the front-page.php file and added

<? query_posts( 'page_id='.$options['front_page'] ); ?>

This is working but im not sure if its the best method or cleanest method. Im trying to make a nice new theme using get_template_parts ,etc.

How should i proceed with the blog page?

currently on my page.php i got:

get_header(); ?>

        <div id="primary">
            <div id="content" role="main">

                <?php the_post(); ?>

                <?php get_template_part( 'content', 'page' ); ?>

                <?php comments_template( '', true ); ?>

            </div><!-- #content -->
        </div><!-- #primary -->

<?php get_footer(); ?>

And on my index.php:

get_header(); ?>

        <div id="primary">
            <div id="content" role="main">

            <?php if ( have_posts() ) : ?>

                <?php /* Start the Loop */ ?>
                <?php while ( have_posts() ) : the_post(); ?>

                    <?php get_template_part( 'content', get_post_format() ); ?>

                <?php endwhile; ?>

            <?php else : ?>

                <article id="post-0" class="post no-results not-found">
                    <header class="entry-header">
                        <h1 class="entry-title"><?php _e( 'No se encuentra la pagina', 'defotografos' ); ?></h1>
                    </header><!-- .entry-header -->

                    <div class="entry-content">
                        <p><?php _e( 'Lo sentimos pero no se puede encontrar lo que busca. tal vez si realiza una b&uacute;squeda podr&aacute; encontrar algo similar.', 'defotografos' ); ?></p>
                        <?php get_search_form(); ?>
                    </div><!-- .entry-content -->
                </article><!-- #post-0 -->

            <?php endif; ?>

            </div><!-- #content -->
        </div><!-- #primary -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

Im trying to make all these nice and clean but im getting a bit lost.

Thanks for your comments and suggestions

share|improve this question
up vote 3 down vote accepted

the front page displays setting as set under settings > reading is stored in the options table under show_on_front, with value either posts or page.

if page is selected, the selected pages are stored in options page_on_front and page_for_posts, with the id of the selected pages as value.

you can update these options yourself from your settings page.

share|improve this answer
Thanks a lot Mile for putting me in the right direction, i need to play a bit more with update_option function! – chifliiiii Oct 14 '11 at 0:12

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.