Exemple #1
0
/**
 * tarski_navbar_select() - Generates a list of checkboxes for the site's pages.
 * 
 * Walks the tree of pages and generates nested ordered lists of pages, with
 * corresponding checkboxes to allow the selection of pages for the navbar.
 * @since 2.2
 */
function tarski_navbar_select()
{
    $pages =& get_pages('sort_column=post_parent,menu_order');
    $nav_pages = explode(',', get_tarski_option('nav_pages'));
    $collapsed_pages = explode(',', get_tarski_option('collapsed_pages'));
    $walker = new WalkerPageSelect($nav_pages, $collapsed_pages);
    $selector = '';
    if (!empty($pages)) {
        $selector = "<ol id=\"navbar-select\">\n" . $walker->walk($pages, 0, 0, array()) . "\n</ol>\n\n";
    }
    if ($pages) {
        $navbar_select = '<p>' . __('Pages selected here will display in your navbar.', 'tarski') . "</p>\n" . $selector . '<input type="hidden" id="opt-collapsed-pages" name="collapsed_pages" value="' . get_tarski_option('collapsed_pages') . '" />' . "\n\n" . '<p>' . __('To change the order in which they appear, edit the &#8216;Page Order&#8217; value on each page.', 'tarski') . "</p>\n";
    } else {
        $navbar_select = false;
    }
    return $navbar_select;
}
/**
 * tarski_navbar_select() - Generates a list of checkboxes for the site's pages.
 * 
 * Walks the tree of pages and generates nested ordered lists of pages, with
 * corresponding checkboxes to allow the selection of pages for the navbar.
 * @since 2.2
 * @param array $pages
 * @param array $selected
 */
function tarski_navbar_select($pages)
{
    $nav_pages = explode(',', get_tarski_option('nav_pages'));
    $collapsed_pages = explode(',', get_tarski_option('collapsed_pages'));
    $walker = new WalkerPageSelect($nav_pages, $collapsed_pages);
    $return = '';
    if (!empty($pages)) {
        $return = "<ol id=\"navbar-select\">\n" . $walker->walk($pages, 0, 0, array()) . "\n</ol>\n\n";
    }
    return $return;
}