treehouse : what would you like to learn today?
Web Design Web Development iOS Development

WordPress php tough question

  • I am working on making a theme in WordPress. I am using SMOF to code the admin area. here is the documentation. SMOF Documentation The SMOF comes with a way to split up a page into block sections. You can then drag and re arrange these blocks. My problem is that I need to query the database of a specific category to get the posts. That is the easy part. The hard part is putting the query into a switch statement so that each post can be moved using the block features. Here is the code snipped for the options framework


    <?php
    $layout = $data['homepage_layout']['enabled'];

    if ($layout):

    foreach ($layout as $key=>$value) {

    switch($key) {

    case 'block_one':
    ?>
    <!--do something here-->

    <?php
    break;
    case 'block_two':
    ?>
    <!--do something here-->

    <?php
    break;
    //repeat as many times necessary

    }

    }

    endif;
    ?>



    Here is my query


    <?php query_posts( array ( 'category_name' => 'homepage', 'posts_per_page' => -1 ) );
    global $more;
    $more= 0;

    while ( have_posts()) : the_post();
    the_excerpt( );


    endwhile;
    wp_reset_query();
    ?>