Example #1
0
/**
 * Initializing action. If you are creating a child theme and you want to override some of Suffusion's actions/filters etc you
 * can add your own action to the hook "after_setup_theme", with a priority > 10 if you want your actions to be executed after
 * Suffusion and with priority < 10 if you want your actions executed before.
 *
 * @return void
 */
function suffusion_theme_setup()
{
    global $pagenow, $suffusion_unified_options, $suffusion;
    suffusion_add_theme_supports();
    suffusion_include_files();
    suffusion_setup_standard_actions_and_filters();
    suffusion_setup_custom_actions_and_filters();
    suffusion_setup_skin();
    foreach ($suffusion_unified_options as $option => $value) {
        global ${$option};
        ${$option} = $value;
    }
    $suffusion = new Suffusion();
    $suffusion->init();
    if (is_admin() && isset($_GET['activated']) && ($pagenow = 'themes.php')) {
        header('Location: ' . admin_url() . 'themes.php?page=suffusion-options-manager&now-active=true');
    }
}
Example #2
0
function suffusion_should_include_dbx()
{
    global $suffusion, $suf_sidebar_1_dnd, $suf_sidebar_2_dnd;
    if (!isset($suffusion) || is_null($suffusion)) {
        $suffusion = new Suffusion();
    }
    $context = $suffusion->get_context();
    $left_count = suffusion_get_left_sidebar_count($context);
    $right_count = suffusion_get_right_sidebar_count($context);
    $total_count = $left_count + $right_count;
    if ($total_count == 0 || $total_count == 1 && $suf_sidebar_1_dnd != "enabled" || $total_count == 2 && $suf_sidebar_1_dnd != "enabled" && $suf_sidebar_2_dnd != "enabled") {
        return false;
    } else {
        return true;
    }
}
Example #3
0
/**
 * Returns the count for the number of posts to be displayed as full posts.
 *
 * @return int
 */
function suffusion_get_full_content_count()
{
    global $suffusion, $suf_category_fc_number, $suf_author_fc_number, $suf_tag_fc_number, $suf_search_fc_number, $suf_archive_fc_number, $suf_index_fc_number, $suf_pop_fc_number, $suf_fc_view_first_only;
    global $suffusion_cpt_post_id;
    if (isset($suffusion_cpt_post_id)) {
        $not_first_page_only = suffusion_get_post_meta($suffusion_cpt_post_id, 'suf_cpt_full_posts_fp_only', true);
        if (!$not_first_page_only && is_paged()) {
            return 0;
        }
        $full_post_count = suffusion_get_post_meta($suffusion_cpt_post_id, 'suf_cpt_full_posts', true);
        $total_posts = suffusion_get_post_meta($suffusion_cpt_post_id, 'suf_cpt_total_posts', true);
        if (!$total_posts || !is_integer($total_posts)) {
            $total_posts = get_option('posts_per_page');
        }
        if (suffusion_admin_check_integer($full_post_count) && $full_post_count > $total_posts) {
            return $total_posts;
        } else {
            if (suffusion_admin_check_integer($full_post_count)) {
                return $full_post_count;
            } else {
                return 0;
            }
        }
    }
    if ($suf_fc_view_first_only == 'first' && is_paged()) {
        return 0;
    }
    if (!isset($suffusion) || is_null($suffusion)) {
        $suffusion = new Suffusion();
    }
    $context = $suffusion->get_context();
    $full_post_count = 0;
    if (in_array('category', $context)) {
        $full_post_count = (int) $suf_category_fc_number;
    } else {
        if (in_array('author', $context)) {
            $full_post_count = (int) $suf_author_fc_number;
        } else {
            if (in_array('tag', $context)) {
                $full_post_count = (int) $suf_tag_fc_number;
            } else {
                if (in_array('search', $context)) {
                    $full_post_count = (int) $suf_search_fc_number;
                } else {
                    if (in_array('date', $context)) {
                        $full_post_count = (int) $suf_archive_fc_number;
                    } else {
                        if (in_array('custom-type', $context)) {
                            //
                        } else {
                            if (in_array('home', $context) || in_array('blog', $context)) {
                                $full_post_count = (int) $suf_index_fc_number;
                            } else {
                                if (in_array('page', $context)) {
                                    if (in_array('posts.php', $context)) {
                                        $full_post_count = (int) $suf_pop_fc_number;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return $full_post_count;
}