示例#1
0
function axiom_sc_gap_wrapper($str)
{
    // Move VC row and column and wrapper inside gap
    $str_new = preg_replace('/(<div\\s+class="[^"]*vc_row[^>]*>)[\\r\\n\\s]*(<div\\s+class="[^"]*vc_col[^>]*>)[\\r\\n\\s]*(<div\\s+class="[^"]*wpb_wrapper[^>]*>)[\\r\\n\\s]*(' . axiom_sc_gap_start() . ')/i', '\\4\\1\\2\\3', $str);
    if ($str_new != $str) {
        $str_new = preg_replace('/(' . axiom_sc_gap_end() . ')[\\r\\n\\s]*(<\\/div>)[\\r\\n\\s]*(<\\/div>)[\\r\\n\\s]*(<\\/div>)/i', '\\2\\3\\4\\1', $str_new);
    }
    // Gap layout
    return str_replace(array(axiom_sc_gap_start(), axiom_sc_gap_end()), array(axiom_close_all_wrappers(false) . '<div class="sc_gap">', '</div>' . axiom_open_all_wrappers(false)), $str_new);
}
示例#2
0
<?php

//===================================== Related posts =====================================
$need_dummy = true;
if (axiom_get_custom_option("show_post_related") == 'yes') {
    if (empty($body_style)) {
        $body_style = axiom_get_custom_option('body_style');
    }
    $sidebar_present = !axiom_sc_param_is_off(axiom_get_custom_option('show_sidebar_main'));
    if ($body_style != 'fullscreen' && !$sidebar_present) {
        axiom_close_all_wrappers();
    }
    $need_wrap = $body_style == 'fullscreen' || !$sidebar_present;
    $args = array('posts_per_page' => axiom_get_custom_option('post_related_count'), 'post_type' => $post_data['post_type'], 'post_status' => current_user_can('read_private_pages') && current_user_can('read_private_posts') ? array('publish', 'private') : 'publish', 'post__not_in' => array($post_data['post_id']));
    if (!empty($post_data['post_terms'][$post_data['post_taxonomy']]->terms_ids)) {
        $args = axiom_query_add_posts_and_cats($args, '', $post_data['post_type'], $post_data['post_terms'][$post_data['post_taxonomy']]->terms_ids, $post_data['post_taxonomy']);
    }
    $args = axiom_query_add_sort_order($args, axiom_get_custom_option('post_related_sort'), axiom_get_custom_option('post_related_order'));
    // Uncomment this section if you want filter related posts on post formats
    if ($post_data['post_type'] == 'post' && $post_data['post_format'] != '' && $post_data['post_format'] != 'standard') {
        if (!isset($args['tax_query'])) {
            $args['tax_query'] = array();
        }
        $args['tax_query'] = array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => 'post-format-' . $post_data['post_format']));
    }
    $args = apply_filters('axiom_filter_related_posts_args', $args, $post_data);
    $recent_posts = get_posts($args, OBJECT);
    $number = is_array($recent_posts) ? count($recent_posts) : 0;
    if ($number > 0) {
        $columns = max(1, axiom_get_custom_option('post_related_columns'));
        if ($columns < 2) {