예제 #1
0
파일: app.php 프로젝트: schiz/scrollax
 /**
  *
  */
 function miss_custom_post_layout()
 {
     global $wp_query, $irish_framework_params;
     $post_obj = $wp_query->get_queried_object();
     $_layout = is_object($post_obj) && isset($post_obj->ID) ? get_post_meta($post_obj->ID, '_layout', true) : 'full_width';
     if (is_singular('portfolio')) {
         add_action('miss_before_post', 'miss_post_title', 1);
         add_action('miss_before_post', 'miss_post_nav', 2);
         add_action('miss_before_post', 'miss_post_image');
     } elseif (miss_is_template('templates/template-works.php')) {
         add_action('miss_before_post', 'miss_post_image');
     }
     if ((is_singular('post') || is_singular('news') || is_singular('testimonials') || is_singular('vacancy')) && !is_singular('portfolio')) {
         add_action('miss_before_post', 'miss_post_date_box');
         add_action('miss_before_post', 'post_feature_display_type');
         add_action('miss_before_post', 'miss_post_title');
     } elseif (miss_is_blog() || is_archive() || (get_option('show_on_front') == 'posts' || get_option('page_on_front') == 0)) {
         if ($irish_framework_params->layout['blog']['blog_layout'] == 'blog_layout1') {
             add_action('miss_before_post', 'miss_post_date_box');
             add_action('miss_before_post', 'post_feature_display_type');
             add_action('miss_before_post', 'miss_post_title');
             add_action('miss_before_post', 'miss_post_meta_edit_author_comments');
             add_action('miss_post_meta_row', 'miss_post_meta_taxonomy_tags');
         } elseif ($irish_framework_params->layout['blog']['blog_layout'] == 'blog_layout2') {
             add_action('miss_before_post', 'miss_post_date_box');
             add_action('miss_before_post', 'post_feature_display_type');
             add_action('miss_before_post', 'miss_post_title');
             add_action('miss_before_post', 'miss_post_meta_edit_author_comments');
             add_action('miss_post_meta_row', 'miss_post_meta_taxonomy_tags');
         } elseif ($irish_framework_params->layout['blog']['blog_layout'] == 'blog_layout3') {
             add_action('miss_before_post', 'miss_post_date_box');
             add_action('miss_before_post', 'post_feature_display_type');
             add_action('miss_before_post', 'miss_post_title');
             add_action('miss_before_post', 'miss_post_meta_edit_author_comments');
             add_action('miss_post_meta_row', 'miss_post_meta_taxonomy_tags');
         } elseif ($irish_framework_params->layout['blog']['blog_layout'] == 'blog_layout4') {
             add_action('miss_before_post', 'post_feature_display_type');
             add_action('miss_before_post', 'miss_post_date_box');
             add_action('miss_before_post', 'miss_post_title');
             add_action('miss_post_meta_row', 'miss_post_meta_long');
         } elseif ($irish_framework_params->layout['blog']['blog_layout'] == 'blog_layout5') {
             add_action('miss_before_post', 'post_feature_display_type');
             add_action('miss_before_post', 'miss_post_title');
             add_action('miss_before_post', 'miss_post_meta_diferent');
         } else {
             add_action('miss_before_post', 'miss_post_date_box');
             add_action('miss_before_post', 'post_feature_display_type');
             add_action('miss_before_post', 'miss_post_title');
             add_action('miss_post_meta_row', 'miss_post_meta_long');
         }
     }
 }
예제 #2
0
파일: core.php 프로젝트: schiz/scrollax
 /**
  *
  */
 function miss_page_title()
 {
     global $irish_framework_params, $wp_query;
     if (is_front_page()) {
         return;
     }
     if (miss_is_template('templates/template-home.php')) {
         return;
     }
     $post_obj = $wp_query->get_queried_object();
     if (!empty($post_obj) && !empty($post_obj->ID) && get_post_meta($post_obj->ID, '_disable_page_title', true)) {
         return;
     }
     $title = '';
     if (is_404()) {
         $title = __('The requested page could not be found', MISS_TEXTDOMAIN);
         $page_tagline = __('Error 404', MISS_TEXTDOMAIN);
     }
     /**
      * Events Calendar PRO Support
      * 
      * @since 1.8
      */
     if (class_exists('TribeEventsPro')) {
         if (function_exists('tribe_is_month') && tribe_is_month()) {
             $title = __('Events for', MISS_TEXTDOMAIN);
             $page_tagline = Date("F Y", strtotime($wp_query->get('start_date')));
         }
         if (function_exists('tribe_is_day') && tribe_is_day()) {
             $title = __('Events for', MISS_TEXTDOMAIN);
             $page_tagline = Date("l, F jS Y", strtotime($wp_query->get('start_date')));
         }
         if (function_exists('tribe_is_week') && tribe_is_week()) {
             if (function_exists('tribe_get_first_week_day')) {
                 $title = sprintf(__('Events for week of %s', MISS_TEXTDOMAIN), Date("l, F jS Y", strtotime(tribe_get_first_week_day($wp_query->get('start_date')))));
             }
             $page_tagline = '';
         }
         if (function_exists('tribe_is_map') && tribe_is_map() || function_exists('tribe_is_photo') && tribe_is_photo()) {
             if (tribe_is_past()) {
                 $title = __('Past Events', MISS_TEXTDOMAIN);
             } else {
                 $title = __('Upcoming Events', MISS_TEXTDOMAIN);
             }
             $page_tagline = '';
         }
         if (function_exists('tribe_is_showing_all') && tribe_is_showing_all()) {
             $title = sprintf('%s %s', __('All events for', MISS_TEXTDOMAIN), get_the_title());
             $page_tagline = '';
         }
     }
     $intro_options = miss_get_setting('intro_options');
     if (is_search()) {
         $title = sprintf(__('Search Results for: %1$s', MISS_TEXTDOMAIN), '‘' . get_search_query() . '’');
     } elseif (is_category()) {
         $title = sprintf(__('Category Archive for: %1$s', MISS_TEXTDOMAIN), '‘' . single_cat_title('', false) . '’');
     } elseif (is_archive() || is_singular('post')) {
         $title = sprintf(__('%1$s', MISS_TEXTDOMAIN), miss_get_setting(get_post_type() . '_page_caption') ? miss_get_setting(get_post_type() . '_page_caption') : get_post_type());
     } elseif (is_tag()) {
         $title = sprintf(__('All Posts Tagged Tag: %1$s', MISS_TEXTDOMAIN), '‘' . single_tag_title('', false) . '’');
     } elseif (is_day()) {
         $title = sprintf(__('Daily Archive for: %1$s', MISS_TEXTDOMAIN), '‘' . get_the_time('F jS, Y') . '’');
     } elseif (is_month()) {
         $title = sprintf(__('Monthly Archive for: %1$s', MISS_TEXTDOMAIN), '‘' . get_the_time('F, Y') . '’');
     } elseif (is_year()) {
         $title = sprintf(__('Yearly Archive for: %1$s', MISS_TEXTDOMAIN), '‘' . get_the_time('Y') . '’');
     } elseif (is_singular('portfolio')) {
         $gallery_id = miss_get_setting('portfolio_page');
         if (!empty($gallery_id)) {
             $title = get_the_title($gallery_id);
         }
     } elseif (function_exists('is_woocommerce') && is_woocommerce()) {
         $shop_page = get_post(woocommerce_get_page_id('shop'));
         $title = miss_get_setting('store_title') ? get_option('store_title') : (get_option('woocommerce_shop_page_title') ? get_option('woocommerce_shop_page_title') : __('Store', MISS_TEXTDOMAIN));
         $page_tagline = miss_get_setting('product_page_tagline') ? get_option('product_page_tagline') : '';
     } elseif (is_author()) {
         global $author;
         $curauth = get_userdata(intval($author));
         $title = sprintf(__('Author Archive for: %1$s', MISS_TEXTDOMAIN), '‘' . $curauth->nickname . '’');
         if (is_search()) {
             $title = printf(__('Search Results: “%s”', MISS_TEXTDOMAIN), get_search_query());
         } elseif (is_tax()) {
             $title = single_term_title("", false);
         } else {
             $shop_page = get_post(woocommerce_get_page_id('shop'));
             $title = miss_get_setting('store_title') ? get_option('store_title') : (get_option('woocommerce_shop_page_title') ? get_option('woocommerce_shop_page_title') : __('Store', MISS_TEXTDOMAIN));
             $page_tagline = miss_get_setting('product_page_tagline') ? get_option('product_page_tagline') : '';
         }
     }
     if (!empty($title)) {
         if (!empty($page_tagline)) {
             $page_tagline = '<span class="page_tagline">' . $page_tagline . '</span>';
             $title .= $page_tagline;
         }
         return '<h1 class="page_title">' . $title . '</h1>';
     } else {
         global $wp_query;
         $post_obj = $wp_query->get_queried_object();
         $post_id = is_object($post_obj) && isset($post_obj->ID) ? $post_obj->ID : '';
         $page_title = get_the_title($post_id);
         if (empty($page_title)) {
             return false;
         }
         $_layout = get_post_meta($post_id, '_intro_text', true);
         $template = get_post_meta($post_id, '_wp_page_template', true);
         if (!isset($page_tagline)) {
             $page_tagline = get_post_meta($post_id, '_page_tagline', true);
         }
         if (!empty($page_tagline)) {
             $page_tagline = '<span class="page_tagline">' . $page_tagline . '</span>';
         } else {
             $page_tagline = '';
         }
         if (is_page()) {
             if (is_front_page() != 1 || $template != 'templates/template-home.php') {
                 return the_title('<h1 class="page_title">', $page_tagline . '</h1>', false);
             } elseif ($_layout == 'default' && $intro_options == 'disable' && $template != 'templates/template-wiki.php') {
                 return the_title('<h1 class="page_title">', $page_tagline . '</h1>', false);
             }
         } else {
             return '<h1 class="page_title">' . get_the_title($post_id) . $page_tagline . '</h1>';
         }
     }
 }
예제 #3
0
파일: scripts.php 프로젝트: schiz/scrollax
/**
 *
 */
function miss_enqueue_script()
{
    global $wp_query;
    # Styles array
    $miss_styles = array('prettyphoto' => MISS_PREFIX . '_prettyphoto');
    # Scripts array
    $miss_script = array('comments' => 'comment-reply', 'tabs' => MISS_PREFIX . '_jquery_tools_tabs', 'flexslider' => MISS_PREFIX . '_flexslider', 'form' => MISS_PREFIX . '_jquery_form', 'prettyphoto' => MISS_PREFIX . '_prettyphoto', 'froogaloop2' => MISS_PREFIX . '_froogaloop2', 'custom' => MISS_PREFIX . '_custom');
    $options = get_option(MISS_SETTINGS);
    $slider_type = apply_filters('miss_slider_type', miss_get_setting('homepage_slider'));
    $post_obj = $wp_query->get_queried_object();
    # Front page
    if (is_front_page()) {
        # check widgets for shortcodes
        if (is_active_sidebar('home')) {
            $widget_sc = miss_sc_widget_text();
            if (in_array('flexslider', $widget_sc)) {
                $flex_unset = false;
            }
            if (in_array('tabs', $widget_sc)) {
                $tabs_unset = false;
            }
            # contact form widget is active
            if (is_active_widget(false, false, 'contact_form', true)) {
                $contactform_unset = false;
            }
        }
    }
    # Singular post/page
    if (is_singular()) {
        $dependencies = get_post_meta($post_obj->ID, '_' . THEME_SLUG . '_dependencies', true);
        # check post meta for scripts
        if (strpos($dependencies, 'miss_scripts') === false && ($options['blog_page'] != $post_obj->ID || empty($options['display_full']))) {
            if (strpos($dependencies, 'flexslider') === false) {
                $flex_unset = true;
            }
            if (strpos($dependencies, 'tabs') === false) {
                $tabs_unset = true;
            }
            if (strpos($dependencies, 'contactform') === false) {
                $contactform_unset = true;
            }
        }
        # post comment styles set to tab
        if (apply_atomic('post_comment_styles', $options['post_comment_styles']) == 'tab' && is_single()) {
            $tabs_unset = false;
        }
        # popular/related post set to tab
        if (apply_atomic('post_like_module', $options['post_like_module']) == 'tab' && is_single()) {
            $tabs_unset = false;
        }
    }
    # if search, archive or 404 page
    if (is_archive() || is_search() || is_404()) {
        $flex_unset = true;
        $tabs_unset = true;
        $contactform_unset = true;
    }
    # check text widgets for shortcodes
    if (!is_front_page()) {
        $widget_sc = miss_sc_widget_text();
        if (in_array('flexslider', $widget_sc)) {
            $flex_unset = false;
        }
        if (in_array('tabs', $widget_sc)) {
            $tabs_unset = false;
        }
        # contact form widget is active
        if (is_active_widget(false, false, 'contact_form', true)) {
            $contactform_unset = false;
        }
    }
    # If slider on every page option enabled
    if (apply_filters('miss_slider_page', miss_get_setting('slider_page'))) {
        if ($slider_type == 'flexslider') {
            $flex_unset = false;
        }
    }
    # unset tabs/fading slider
    if (!empty($tabs_unset)) {
        //unset( $miss_script['tabs'] );
        # unset flex
        if (!empty($flex_unset)) {
            unset($miss_script['flexslider']);
        }
    }
    # unset form
    if (!empty($contactform_unset)) {
        unset($miss_script['form']);
    }
    # unset WP comment-reply
    if (!is_singular() || !comments_open() || get_option('thread_comments') != 1) {
        unset($miss_script['comments']);
    }
    # unset buddypress if not exists
    if (!function_exists('bp_is_active')) {
        /* unset bp styles */
        unset($miss_styles['bp_defaults']);
        unset($miss_styles['bp_admin_bar']);
        /* unset bp scripts */
        unset($miss_script["bp"]);
    }
    # Styles filter
    $enqueue_styles = apply_atomic('styles', $miss_styles);
    if (!empty($enqueue_styles)) {
        foreach ($enqueue_styles as $style) {
            wp_enqueue_style($style);
        }
    }
    # Scripts filter
    $enqueue_script = apply_atomic('scripts', $miss_script);
    if (!empty($enqueue_script)) {
        foreach ($enqueue_script as $script) {
            wp_enqueue_script($script);
        }
    }
    //enqueue scripts
    $data = miss_local_assets('assets');
    if (!miss_is_template('templates/template-works.php')) {
        $data = miss_unload_assets($data, 'isotope');
    }
    if (miss_get_setting('responsive') == 'disabled') {
        $data = miss_unload_assets($data, 'responsive');
    }
    if (get_post_type() == 'miss_gallery') {
        wp_register_script('miss_gallery', '' . THEME_JS . '/gallery/init.js', false, null, true);
        wp_register_script('qs', '' . THEME_JS . '/jquery/jquery.quicksand.js', false, null, true);
        wp_register_script('nicescroll', '' . THEME_JS . '/jquery/jquery.nicescroll.js', false, null, true);
        wp_enqueue_script('nicescroll');
        wp_enqueue_script('qs');
    }
    miss_collect_assets($data, $property = 'scripts', $action = 'enqueue');
}