コード例 #1
0
function weaverx_page_lead($who, $archive = false)
{
    // common lead in for all pages with infobar and top widget area
    $GLOBALS['weaverx_page_who'] = $who;
    $GLOBALS['weaverx_page_is_archive'] = $archive;
    get_header($who);
    if ($archive) {
        $sb_layout = weaverx_sb_layout_archive($who);
    } else {
        $sb_layout = weaverx_sb_layout($who);
    }
    weaverx_container_div($who);
    // #container
    get_template_part('templates/infobar');
    weaverx_sidebar_before($sb_layout, $who);
    // sidebars if top-stacking
    do_action('weaverx_per_page');
    echo '<div id="content" role="main"' . weaverx_content_class($sb_layout, $who, false) . ">\n";
    weaverx_inject_area('precontent');
    return $sb_layout;
}
コード例 #2
0
function weaverx_body_classes($classes)
{
    /**
     * Add classes to body depending of page type to make sidebar templates work.
     */
    $pwp = in_array('page-template-paget-posts-php', $classes);
    $has_posts = false;
    if ($pwp) {
        // page with posts - add stuff like blog
        $classes[] = 'blog';
        $has_posts = true;
    }
    if (!is_multi_author()) {
        $classes[] = 'single-author';
    }
    if (is_singular() && !is_home() && !$pwp) {
        // don't make pwp singular
        $classes[] = 'singular';
    }
    if (!is_user_logged_in()) {
        $classes[] = 'not-logged-in';
    }
    $classes[] = 'weaverx-theme-body is-menu-desktop is-menu-default';
    if (weaverx_get_per_page_value('_pp_bodyclass') != '') {
        // add body class per page
        $classes[] = weaverx_get_per_page_value('_pp_bodyclass');
    }
    if (isset($GLOBALS['weaverx_page_who'])) {
        if ($GLOBALS['weaverx_page_is_archive']) {
            $sb_layout = weaverx_sb_layout_archive($GLOBALS['weaverx_page_who']);
            if ($GLOBALS['weaverx_page_who'] != '404') {
                $has_posts = true;
            }
        } else {
            $sb_layout = weaverx_sb_layout($GLOBALS['weaverx_page_who']);
        }
        $classes[] = 'weaverx-page-' . $GLOBALS['weaverx_page_who'];
        $GLOBALS['weaverx_sb_layout'] = $sb_layout;
        $classes[] = 'weaverx-sb-' . $sb_layout;
        if ($has_posts || $GLOBALS['weaverx_page_who'] == 'single' || $GLOBALS['weaverx_page_who'] == 'blog') {
            $classes[] = 'has-posts';
        }
    }
    return $classes;
}
コード例 #3
0
 * We buffer the output from the inject-prmain up to the end of the page content
 * We create the page-navi part of the infobar after we restart the loop
 * Then output the infobar with the page breadcrumbs and the posts page-navi and the page buffer
 * Finally, start the new loop.
 */
$GLOBALS['weaverx_page_who'] = 'pwp';
$GLOBALS['weaverx_page_is_archive'] = false;
// need these for body class
get_header('pwp');
// build infobar front part - replace get_template_part('infobar'); with local code
// we need to build it in a buffer
weaverx_container_div('pwp');
// #container
ob_start();
// generate the stuff that comes AFTER the infobar for pwp since we can't generate page nav until later
$sb_layout = weaverx_sb_layout('blog');
// ********* get_template_part('templates/infobar');	// put the info bar
weaverx_sidebar_before($sb_layout, 'blog');
// sidebars if top-stacking
do_action('weaverx_per_page');
$paged = weaverx_get_page();
// and next the content area.
echo '<div id="content" role="main" ' . weaverx_content_class($sb_layout, 'pwp', false) . ">\n";
weaverx_inject_area('precontent');
weaverx_sb_precontent('blog');
weaverx_post_count_clear();
the_post();
if (!is_front_page()) {
    $GLOBALS['weaverx_pwp_title'] = get_the_title();
    // Make breadcrumbs work a bit better
}