WordPress.org

Ready to get started?Download WordPress

Forums

OptionTree
Sorting page checkbox result (1 post)

  1. sirdevis
    Member
    Posted 1 year ago #

    Hi, I need help to sort the page checkbox result.

    I'm using this option to show some pages in a static home pages, but I'd like to sort them by page order (menu_order).

    This is my code:

    ============
    if ( function_exists( 'ot_get_option' ) ) {
    $home_page_content = ot_get_option( 'home_page_content', array() );
    if ( ! empty( $home_page_content ) ) {
    foreach( $home_page_content as $home_page_element_id ) {
    $page_data = get_page( $home_page_element_id );
    echo '<h3>'. $page_data->post_title .'</h3>';
    echo apply_filters('the_content', $page_data->post_content);
    echo '<h2>'. $page_data->menu_order .'</h2>';
    }
    }
    else {echo 'Please select at least one page from Apparence => Theme Options => General Settings => Home Page Content';}
    }
    else {echo 'Option tree disabled';}
    ============

    I guess I've to create a new array, sort it out and then echo the page data, but I'm a little stuck..

    Any help? :)
    Thanks

    http://wordpress.org/extend/plugins/option-tree/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic