Esempio n. 1
2
function base_getBreadcrumbs()
{
    if (is_404()) {
        return false;
    }
    // Hack to fix breadcrumbs when you're viewing the news home
    if (is_home()) {
        $post = new \Timber\Post(get_option('page_for_posts'));
    } else {
        global $post;
    }
    $breadcrumbs = [];
    if ($post->post_parent) {
        $parent_id = $post->post_parent;
        while ($parent_id) {
            $page = get_page($parent_id);
            $breadcrumbs[] = new \Timber\Post($page->ID);
            $parent_id = $page->post_parent;
        }
        $breadcrumbs = array_reverse($breadcrumbs);
    }
    // Add 'Blog Home' to breadcrumbs if you're on a news post or archive
    if ((is_single() || is_archive()) && !is_search()) {
        $breadcrumbs[] = new \Timber\Post(get_option('page_for_posts'));
    }
    return $breadcrumbs;
}
 function presscore_search_title_shortcode()
 {
     $title = '';
     $wrap_class = '';
     if (is_search()) {
         $title = get_search_query();
     } else {
         if (is_archive()) {
             if (is_category()) {
                 $title = single_cat_title('', false);
             } elseif (is_tag()) {
                 $title = single_tag_title('', false);
             } elseif (is_author()) {
                 the_post();
                 $title = '<a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta("ID"))) . '" title="' . esc_attr(get_the_author()) . '" rel="me">' . get_the_author() . '</a>';
                 $wrap_class .= ' vcard';
                 rewind_posts();
             } elseif (is_day()) {
                 $title = '<span>' . get_the_date() . '</span>';
             } elseif (is_month()) {
                 $title = '<span>' . get_the_date('F Y');
             } elseif (is_year()) {
                 $title = '<span>' . get_the_date('Y');
             } elseif (is_tax('dt_portfolio_category')) {
                 $title = single_term_title('', false);
             } elseif (is_tax('dt_gallery_category')) {
                 $title = single_term_title('', false);
             }
         }
     }
     if ($title) {
         $title = '<span' . ($wrap_class ? ' class="' . esc_attr($wrap_class) . '"' : '') . '>' . $title . '</span>';
     }
     return $title;
 }
Esempio n. 3
0
function wp_page_numbers_stylesheet()
{
    $settings = get_option('wp_page_numbers_array');
    $head_stylesheet = $settings["head_stylesheetsheet"];
    $head_stylesheet_folder_name = $settings["head_stylesheetsheet_folder_name"];
    $style_theme = $settings["style_theme"];
    if ($head_stylesheet == "on" || $head_stylesheet == "" && (is_archive() || is_search() || is_home() || is_page())) {
        echo '<link rel="stylesheet" href="' . WP_PLUGIN_URL . '/wp-page-numbers/';
        if ($head_stylesheet_folder_name == "") {
            if ($style_theme == "default") {
                echo 'default';
            } elseif ($style_theme == "classic") {
                echo 'classic';
            } elseif ($style_theme == "tiny") {
                echo 'tiny';
            } elseif ($style_theme == "panther") {
                echo 'panther';
            } elseif ($style_theme == "stylish") {
                echo 'stylish';
            } else {
                echo 'default';
            }
        } else {
            echo $head_stylesheet_folder_name;
        }
        echo '/wp-page-numbers.css" type="text/css" media="screen" />';
    }
}
Esempio n. 4
0
function insert_wp_about_author($content)
{
    $wp_about_author_settings = array();
    $wp_about_author_settings = get_option('wp_about_author_settings');
    if (is_front_page() && isset($wp_about_author_settings['wp_author_display_front']) && $wp_about_author_settings['wp_author_display_front']) {
        $content = $content . wp_about_author_display();
    } else {
        if (is_archive() && isset($wp_about_author_settings['wp_author_display_archives']) && $wp_about_author_settings['wp_author_display_archives']) {
            $content = $content . wp_about_author_display();
        } else {
            if (is_search() && isset($wp_about_author_settings['wp_author_display_search']) && $wp_about_author_settings['wp_author_display_search']) {
                $content = $content . wp_about_author_display();
            } else {
                if (is_page() && isset($wp_about_author_settings['wp_author_display_pages']) && $wp_about_author_settings['wp_author_display_pages']) {
                    $content = $content . wp_about_author_display();
                } else {
                    if (is_single() && isset($wp_about_author_settings['wp_author_display_posts']) && $wp_about_author_settings['wp_author_display_posts']) {
                        $content = $content . wp_about_author_display();
                    } else {
                        if (is_feed() && isset($wp_about_author_settings['wp_author_display_feed']) && $wp_about_author_settings['wp_author_display_feed']) {
                            $content = $content . wp_about_author_display(true);
                        } else {
                            $content = $content;
                        }
                    }
                }
            }
        }
    }
    return $content;
}
Esempio n. 5
0
 function tography_lite_enqueue_stylesheets()
 {
     //Bootstrap =======================================================
     wp_register_style('bootstrap', TOGRAPHY_LITE_CSS . '/bootstrap.css', array(), '3.1', 'all');
     wp_enqueue_style('bootstrap');
     //=================================================================
     if (is_page_template('page-portfolio-thirds.php') || is_archive()) {
         //Isotope ================================================
         wp_register_style('isotope', TOGRAPHY_LITE_CSS . '/isotope.css', array(), '1.0', 'all');
         wp_enqueue_style('isotope');
         //=================================================================
         //Photoswipe ======================================================
         wp_register_style('photoswipe', TOGRAPHY_LITE_CSS . '/photoswipe.css', array(), '2.0.0', 'all');
         wp_enqueue_style('photoswipe');
         //=================================================================
         //Photoswipe Skin ======================================================
         wp_register_style('photoswipe-skin', TOGRAPHY_LITE_CSS . '/default-skin/default-skin.css', array(), '2.0.0', 'all');
         wp_enqueue_style('photoswipe-skin');
         //=================================================================
     }
     if (is_single() || is_archive()) {
         //Photoswipe ======================================================
         wp_register_style('photoswipe', TOGRAPHY_LITE_CSS . '/photoswipe.css', array(), '2.0.0', 'all');
         wp_enqueue_style('photoswipe');
         //=================================================================
         //Photoswipe Skin ======================================================
         wp_register_style('photoswipe-skin', TOGRAPHY_LITE_CSS . '/default-skin/default-skin.css', array(), '2.0.0', 'all');
         wp_enqueue_style('photoswipe-skin');
         //=================================================================
     }
     //Main Stylesheet =================================================
     wp_register_style('main-stylesheet', get_bloginfo('stylesheet_url'), array('bootstrap'), '1.0', 'all');
     wp_enqueue_style('main-stylesheet');
     //=================================================================
 }
Esempio n. 6
0
 function widget($args, $instance)
 {
     global $wp_query;
     $facets = elasticsearch\Faceting::all();
     $url = null;
     if (is_category() || is_tax()) {
         $url = get_term_link($wp_query->queried_object);
     } elseif (is_tag()) {
         $url = get_tag_link($wp_query->queried_object->term_id);
     } elseif (is_archive()) {
         $url = get_post_type_archive_link($wp_query->queried_object->query_var);
     } elseif (is_search()) {
         $url = home_url('/');
     }
     foreach ($facets as $type => $facet) {
         if (count($facet['selected']) > 0) {
             $name = $type;
             if (taxonomy_exists($type)) {
                 $name = get_taxonomy($type)->label;
             }
             echo '<aside id="facet-' . $type . '-selected" class="widget facets facets-selected">';
             echo '<h3 class="widget-title">' . $name . '</h3>';
             echo '<ul>';
             foreach ($facet['selected'] as $option) {
                 $url = elasticsearch\Faceting::urlRemove($url, $type, $option['slug']);
                 echo '<li id="facet-' . $type . '-' . $option['slug'] . '" class="facet-item">';
                 echo '<a href="' . $url . '">' . $option['name'] . '</a>';
                 echo '</li>';
             }
             echo '</ul>';
             echo '</aside>';
         }
     }
 }
function thinkup_input_sliderclass($classes)
{
    global $thinkup_homepage_sliderswitch;
    global $thinkup_homepage_sliderpresetwidth;
    global $post;
    if (!empty($post->ID)) {
        $_thinkup_meta_slider = get_post_meta($post->ID, '_thinkup_meta_slider', true);
        $_thinkup_meta_sliderpage = get_post_meta($post->ID, '_thinkup_meta_sliderimages', true);
    }
    if (is_front_page() or thinkup_check_ishome()) {
        if (empty($thinkup_homepage_sliderswitch) or $thinkup_homepage_sliderswitch == 'option1') {
            if (empty($thinkup_homepage_sliderpresetwidth) or $thinkup_homepage_sliderpresetwidth == '1') {
                $classes[] = 'slider-full';
            } else {
                $classes[] = 'slider-boxed';
            }
        }
    } else {
        if (!is_front_page() and !thinkup_check_ishome() and !is_archive() and !thinkup_check_isblog() and $_thinkup_meta_slider == 'on') {
            if (is_array($_thinkup_meta_sliderpage)) {
                if ($_thinkup_meta_sliderpage['full_width'] == 'on') {
                    $classes[] = 'slider-full';
                } else {
                    $classes[] = 'slider-boxed';
                }
            }
        }
    }
    return $classes;
}
Esempio n. 8
0
/**
 * Post Tumblog Icons
 * in all formats when tumblog icons are enabled
 * 
 * @since 1.0.0
 */
function reactor_do_tumblog_icons()
{
    if (reactor_option('tumblog_icons', false) && (is_home() || is_archive()) && current_theme_supports('reactor-tumblog-icons')) {
        $output = reactor_tumblog_icon();
        echo $output;
    }
}
Esempio n. 9
0
/**
 * Enqueues scripts and styles for front-end.
 *
*/
function galanight_scripts_styles()
{
    global $wp_styles, $wp_scripts, $galanight_options_db;
    // Adds JavaScript
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
    if ($galanight_options_db['galanight_infinite_scroll'] != 'Disable') {
        if (is_home() || is_archive() || is_search()) {
            wp_enqueue_script('galanight-infinitescroll', get_template_directory_uri() . '/js/infinitescroll.js', array('jquery'), '2.0.2', true);
            wp_enqueue_script('galanight-infinitescroll-settings', get_template_directory_uri() . '/js/infinitescroll-settings.js', array(), '1.0', true);
            $galanight_site_parameters = array('theme_directory' => get_template_directory_uri(), 'message_load' => __('<p>Loading...</p>', 'galanight'), 'message_end' => __('<p>No further posts.</p>', 'galanight'));
            wp_localize_script('galanight-infinitescroll-settings', 'SiteParameters', $galanight_site_parameters);
        }
    }
    wp_enqueue_script('galanight-placeholders', get_template_directory_uri() . '/js/placeholders.js', array('jquery'), '2.0.8', true);
    if ($galanight_options_db['galanight_display_scroll_top'] != 'Hide') {
        wp_enqueue_script('galanight-scroll-to-top', get_template_directory_uri() . '/js/scroll-to-top.js', array('jquery'), '1.0', true);
    }
    if (has_nav_menu('main-navigation') && $galanight_options_db['galanight_header_layout'] == 'Centered' && !is_page_template('template-landing-page.php')) {
        wp_enqueue_script('galanight-menubox', get_template_directory_uri() . '/js/menubox.js', array(), '1.0', true);
    }
    wp_enqueue_script('galanight-selectnav', get_template_directory_uri() . '/js/selectnav.js', array(), '0.1', true);
    wp_enqueue_script('galanight-responsive', get_template_directory_uri() . '/js/responsive.js', array(), '1.0', true);
    wp_enqueue_script('galanight-html5-ie', get_template_directory_uri() . '/js/html5.js', array(), '3.6', false);
    $wp_scripts->add_data('galanight-html5-ie', 'conditional', 'lt IE 9');
    // Adds CSS
    wp_enqueue_style('galanight-elegantfont', get_template_directory_uri() . '/css/elegantfont.css');
    wp_enqueue_style('galanight-google-font-default', '//fonts.googleapis.com/css?family=Oswald&amp;subset=latin,latin-ext');
    if (class_exists('woocommerce')) {
        wp_enqueue_style('galanight-woocommerce-custom', get_template_directory_uri() . '/css/woocommerce-custom.css');
    }
}
Esempio n. 10
0
/**
 * Custom class for the WP 'body_class()' function
 * updated: 4/15/10
 */
function dbdb_body_classes($classes)
{
    // source http://darrinb.com/notes/2010/customizing-the-wordpress-body_class-function/
    global $post;
    global $wp_query;
    // if there is no parent ID and it's not a single post page, category page, or 404 page, give it
    // a class of "parent-page"
    if ($post->post_parent < 1 && !is_single() && !is_archive() && !is_404()) {
        $classes[] = 'parent-page';
    }
    // if the page/post has a parent, it's a child, give it a class of its parent name
    if ($post->post_parent > 0) {
        /* $parent_title = get_the_title($wp_query->post->post_parent);
           $parent_title = preg_replace('#\s#','-', $parent_title);
           $parent_title = strtolower($parent_title);
           $classes[] = 'parent-pagename-'.$parent_title; */
        $parent_id = wp_get_post_parent_id($wp_query->post);
        // $parent_id = get_the_ID($wp_query->post->post_parent);
        echo "PARENT ID : " . $parent_id;
        // $parent_id = preg_replace('#\s#','-', $parent_id);
        $parent_id = strtolower($parent_id);
        $classes[] = 'parent-id-' . $parent_id;
    }
    // add a class = to the name of post or page
    $classes[] = $wp_query->queried_object->post_name;
    return array_unique($classes);
}
Esempio n. 11
0
/**
 * Enqueues scripts and styles for front-end.
 *
*/
function shootingstar_scripts_styles()
{
    global $wp_styles, $wp_scripts;
    // Adds JavaScript
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
    if (get_theme_mod('shootingstar_infinite_scroll') != 'Disable') {
        if (is_home() || is_archive() || is_search()) {
            wp_enqueue_script('shootingstar-infinitescroll', get_template_directory_uri() . '/js/infinitescroll.min.js', array('jquery'), '2.0.2', true);
            wp_enqueue_script('shootingstar-infinitescroll-settings', get_template_directory_uri() . '/js/infinitescroll-settings.js', array(), '1.0', true);
            $shootingstar_site_parameters = array('theme_directory' => get_template_directory_uri(), 'message_load' => __('<p>Loading...</p>', 'shootingstar'), 'message_end' => __('<p>No further posts.</p>', 'shootingstar'));
            wp_localize_script('shootingstar-infinitescroll-settings', 'SiteParameters', $shootingstar_site_parameters);
        }
    }
    wp_enqueue_script('shootingstar-placeholders', get_template_directory_uri() . '/js/placeholders.js', array('jquery'), '2.0.8', true);
    if (get_theme_mod('shootingstar_display_scroll_top') != 'Hide') {
        wp_enqueue_script('shootingstar-scroll-to-top', get_template_directory_uri() . '/js/scroll-to-top.js', array('jquery'), '1.0', true);
    }
    if (get_theme_mod('shootingstar_fixed_menu') != 'Disable' && !is_page_template('template-landing-page.php')) {
        wp_enqueue_script('shootingstar-menubox', get_template_directory_uri() . '/js/menubox.js', array(), '1.0', true);
    }
    wp_enqueue_script('shootingstar-selectnav', get_template_directory_uri() . '/js/selectnav.js', array(), '0.1', true);
    wp_enqueue_script('shootingstar-responsive', get_template_directory_uri() . '/js/responsive.js', array(), '1.0', true);
    wp_enqueue_script('shootingstar-html5-ie', get_template_directory_uri() . '/js/html5.min.js', array(), '3.7.2', false);
    $wp_scripts->add_data('shootingstar-html5-ie', 'conditional', 'lt IE 9');
    // Adds CSS
    wp_enqueue_style('shootingstar-elegantfont', get_template_directory_uri() . '/css/elegantfont.css');
    wp_enqueue_style('shootingstar-google-font-default', '//fonts.googleapis.com/css?family=PT+Sans&amp;subset=latin,latin-ext');
    if (class_exists('woocommerce')) {
        wp_enqueue_style('shootingstar-woocommerce-custom', get_template_directory_uri() . '/css/woocommerce-custom.css');
    }
}
function _act_get_body_data()
{
    global $post;
    $body_data = array();
    //  echo 'pid';
    //
    $post_type = get_post_type(get_the_ID());
    if (is_archive()) {
        $post_type = "archive";
    }
    if (is_front_page()) {
        $post_type = 'home';
    }
    $body_data['post-type'] = $post_type;
    $post_slug = $post->post_name;
    if (is_archive() and isset(get_queried_object()->taxonomy)) {
        $tax = get_taxonomy(get_queried_object()->taxonomy);
        $post_slug = sanitize_title($tax->labels->singular_name);
    } elseif (is_archive() and !isset(get_queried_object()->taxonomy)) {
        $post_slug = get_queried_object()->name;
    }
    if (is_home()) {
        $post_slug = 'blog';
    }
    if (is_home() && is_paged()) {
        $post_slug = 'blog_paged';
    }
    $body_data['post-slug'] = $post_slug;
    return $body_data;
}
Esempio n. 13
0
    /**
     * Print the previous and next links depending on the current template.
     */
    function sosimple_pagination()
    {
        global $wp_query;
        if (is_single()) {
            ?>
		<nav class="nav single-nav" role="navigation">
			<span class="home"><a href="<?php 
            echo esc_url(home_url('/'));
            ?>
"></a></span>
		</nav>
	<?php 
        } elseif ($wp_query->max_num_pages > 1 && (is_home() || is_archive() || is_search())) {
            ?>
		<nav class="nav paged-nav" role="navigation">
			<span class="previous"><?php 
            previous_posts_link('');
            ?>
</span>
			<span class="next"><?php 
            next_posts_link('');
            ?>
</span>
		</nav>
	<?php 
        }
    }
Esempio n. 14
0
function willow_the_content_filter($content)
{
    if (is_home() || is_archive()) {
        $content = willow_make_excerpt($content);
    }
    return $content;
}
 /**
  * Function: custom_get_wpml_language_link - custom code for getting wpml language toggle link
  * Author: JF
  * Date: May 29, 2014
  */
 function custom_get_wpml_language_link()
 {
     global $post, $current_child_site, $wp_query, $home_url;
     $wpml_post_name = '';
     //get current inactive language code
     $get_inactive_language = custom_get_inactive_language();
     // get the post ID in en
     $wpml_post_id = icl_object_id($post->ID, $post->post_type, true, $get_inactive_language['language_code']);
     // get the post object
     $wpml_post_obj = get_post($wpml_post_id);
     // get the name
     $wpml_post_name = $wpml_post_obj->post_name;
     if (is_archive()) {
         $wpml_post_name = $wp_query->query['post_type'];
     }
     if (is_singular('cpt')) {
         $wpml_post_name = 'cpt/' . $wpml_post_name;
     }
     if (is_front_page()) {
         $wpml_post_name = '';
     }
     if (is_home()) {
         //check home blog listing
         //$wpml_post_name = 'blog';
     }
     if (is_page()) {
         $translated_url = get_permalink($wpml_post_id);
         return '<a href="' . $translated_url . '">' . $get_inactive_language['native_name'] . '</a>';
     } else {
         //output language switch link
         return '<a href="' . $home_url . '/' . $get_inactive_language['language_code'] . '/' . $wpml_post_name . '/">' . $get_inactive_language['native_name'] . '</a>';
     }
 }
Esempio n. 16
0
/**
 * Filter archives to display one less post per page to account for the .page-title circle
 */
function spun_limit_posts_per_archive_page()
{
    if (!is_home() && is_archive() || is_search()) {
        $posts_per_page = intval(get_option('posts_per_page')) - 1;
        set_query_var('posts_per_page', $posts_per_page);
    }
}
Esempio n. 17
0
/**
 * Page titles
 */
function roots_title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            return get_the_title(get_option('page_for_posts', true));
        } else {
            return __('Most Recent Posts', 'roots');
        }
    } elseif (is_archive()) {
        $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
        if ($term) {
            return apply_filters('single_term_title', $term->name);
        } elseif (is_post_type_archive()) {
            return apply_filters('the_title', get_queried_object()->labels->name);
        } elseif (is_day()) {
            return sprintf(__('Old Posts, Organized by Day: %s', 'roots'), get_the_date());
        } elseif (is_month()) {
            return sprintf(__('Old Posts, Organized by Month: %s', 'roots'), get_the_date('F Y'));
        } elseif (is_year()) {
            return sprintf(__('Old Posts, Organized by Year: %s', 'roots'), get_the_date('Y'));
        } elseif (is_author()) {
            $author = get_queried_object();
            return sprintf(__('Old Posts, Organized by Author: %s', 'roots'), apply_filters('the_author', is_object($author) ? $author->display_name : null));
        } else {
            return single_cat_title('', false);
        }
    } elseif (is_search()) {
        return sprintf(__('Search Results for %s', 'roots'), get_search_query());
    } elseif (is_404()) {
        return __('Not Found', 'roots');
    } else {
        return get_the_title();
    }
}
Esempio n. 18
0
/**
 * Page titles
 */
function pinnacle_title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            return get_the_title(get_option('page_for_posts', true));
        } else {
            return __('Latest Posts', 'pinnacle');
        }
    } elseif (is_archive()) {
        $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
        if ($term) {
            return $term->name;
        } elseif (is_post_type_archive()) {
            return get_queried_object()->labels->name;
        } elseif (is_day()) {
            return sprintf(__('Daily Archives: %s', 'pinnacle'), get_the_date());
        } elseif (is_month()) {
            return sprintf(__('Monthly Archives: %s', 'pinnacle'), get_the_date('F Y'));
        } elseif (is_year()) {
            return sprintf(__('Yearly Archives: %s', 'pinnacle'), get_the_date('Y'));
        } elseif (is_author()) {
            return sprintf(__('Author Archives: %s', 'pinnacle'), get_the_author());
        } else {
            return single_cat_title("", false);
        }
    } elseif (is_search()) {
        return sprintf(__('Search Results for %s', 'pinnacle'), get_search_query());
    } elseif (is_404()) {
        return __('Not Found', 'pinnacle');
    } else {
        return get_the_title();
    }
}
Esempio n. 19
0
function featureText()
{
    if (is_front_page()) {
        the_field('feature_text');
    } elseif (is_home() || is_single()) {
        _e('Rock Theme Official Blog');
    } elseif (is_archive()) {
        _e('Rock Theme Official Blog');
        _e('<br>');
        single_term_title('Browsing: ');
        if (is_month()) {
            $monthNum = get_query_var('monthnum');
            $month = date('F', mktime(0, 0, 0, $monthNum));
            $year = get_query_var('year');
            echo 'Posts from ' . $month . ' ' . $year;
        }
    } elseif (is_page_template('page-news.php') || is_page_template('page-about.php') || is_page_template('page-contact.php')) {
        bloginfo('name');
        _e('<br>');
        the_title();
    } elseif (is_404()) {
        _e('Whoops, were a little lost.');
    } elseif (is_search()) {
        _e('Rock Theme Official Blog');
        _e('<br>');
        printf('Search results for: %s', get_search_query());
    }
}
function ssb_display($content)
{
    $ssb_share_content_position = get_option('ssb_share_content_position');
    $ssb_share_content_display = get_option('ssb_share_content_display');
    $ssb_share_filter_posttype = get_option('ssb_share_filter_posttype');
    if ($ssb_share_filter_posttype == NULL) {
        $type = 'none';
    } else {
        $type = '';
        foreach ($ssb_share_filter_posttype as $post_type => $post_type_value) {
            $type .= $post_type . ',';
        }
    }
    if (is_singular(explode(',', $type)) or is_home() && ssb_share_home_display() or is_archive() && ssb_share_archive_display()) {
        $content_new = '';
        if ($ssb_share_content_position == 'top') {
            $content_new .= ssb_share_icons();
            $content_new .= $content;
        } elseif ($ssb_share_content_position == 'bottom') {
            $content_new .= $content;
            $content_new .= ssb_share_icons();
        }
        if ($ssb_share_content_display == 'yes') {
            return $content_new;
        } else {
            return $content;
        }
    } else {
        return $content;
    }
}
Esempio n. 21
0
 /**
  * Gets the page type from WordPress.
  *
  * @return string A string representation of the current page type,
  *     corresponding to the values used by publisherplugin.google.com.
  */
 public static function getWordPressPageType()
 {
     // is_front_page() returns true if (1) a static front page is set and this
     // is that page, or (2) the front page is the blog home page and this
     // is the blog home page.
     if (is_front_page()) {
         return 'front';
     }
     if (is_home()) {
         return 'home';
     }
     if (is_single()) {
         return 'singlePost';
     }
     if (is_page()) {
         return 'page';
     }
     if (is_category()) {
         return 'category';
     }
     if (is_archive()) {
         return 'archive';
     }
     if (is_search()) {
         return 'search';
     }
     if (is_404()) {
         return 'errorPage';
     }
     return '';
 }
function gmdl_mdl_post_footer_class($args)
{
    if (is_home() || is_single() || is_archive()) {
        $args['class'] .= ' mdl-card__actions mdl-card--border';
    }
    return $args;
}
Esempio n. 23
0
function document_title($title = '', $sep = '-', $seplocation = 'right')
{
    // Remove default seperator and add spacing
    if (trim($sep) === '' || $sep === '&raquo;' || $sep === '&#187;') {
        $sep = '-';
    }
    $sep = ' ' . $sep . ' ';
    // Determine page number, if any
    $page_num = '';
    if (is_paged()) {
        global $page, $paged;
        if ($paged >= 2 || $page >= 2) {
            $page_num = $sep . sprintf(esc_html__('Page %d', 'ubik'), max($paged, $page));
        }
    }
    // Generate the title using our all-purpose title function
    $title = apply_filters('ubik_seo_document_title_raw', ubik_title());
    $name = get_bloginfo('name');
    $desc = get_bloginfo('description');
    // Handle three scenarios: home/front page, archive feeds, and everything else
    if (is_front_page() || is_home()) {
        $title = $name;
        if (!empty($desc) && !is_paged()) {
            $title .= $sep . $desc;
        }
    } elseif (is_feed() && is_archive()) {
        $title = $sep . $title;
        // Adding the separator alters the default archive feed title output
    } else {
        $title = $title . $sep . $name;
    }
    // Sanitize and add page number as needed
    $title = esc_html(strip_tags(stripslashes(preg_replace('/\\s+/', ' ', trim($title . $page_num)))));
    return apply_filters('ubik_seo_document_title_final', $title);
}
Esempio n. 24
0
function store_seo_info()
{
    if (get_post_type() == 'store' && !is_singular()) {
        $id = get_queried_object_id();
        if ((taxonomy_exists('products_category') || taxonomy_exists('products_tag')) && $id != 0) {
            $term_name = get_term_field('name', $id, 'products_category');
            $title = $term_name;
            $paged = get_query_var('paged');
            if ($paged > 1) {
                $title .= sprintf(__(' - 第 %s 页 ', 'tinection'), $paged);
            }
            $title .= ' - ' . get_bloginfo('name') . '商城';
            $keywords = $term_name . ",商城";
            $description = strip_tags(term_description());
        } elseif (is_archive() && $id == 0) {
            $title = ot_get_option('shop_archives_title', 'WordPress商店');
            $paged = get_query_var('paged');
            if ($paged > 1) {
                $title .= sprintf(__(' - 第 %s 页 ', 'tinection'), $paged);
            }
            $title .= ' - ' . get_bloginfo('name');
            $keywords = '商品归档,商城,归档';
            $description = get_bloginfo('name') . '商城';
        }
        $seo_text = '<title>' . $title . '</title><meta name="description" content="' . $description . '" /><meta name="keywords" content="' . $keywords . '" />';
    } else {
        $seo_text = '';
    }
    return $seo_text;
}
 function wpex_blog_exclude_categories()
 {
     // Wait..we don't want to be in these plages? Lets leave now!
     if (is_admin()) {
         return;
     }
     if (is_search()) {
         return;
     }
     if (is_archive()) {
         return;
     }
     // Categories to exclude
     $cats_to_exclude = wpex_option('blog_cats_exclude');
     // Admin option is blank, so bail.
     if ($cats_to_exclude == '') {
         return;
     }
     // Blog template
     if (is_home() && !is_singular('page')) {
         $exclude = $cats_to_exclude;
     } else {
         return;
         // Do nothing, ok?
     }
     if ($cats_to_exclude) {
         set_query_var('category__not_in', $cats_to_exclude);
     }
 }
Esempio n. 26
0
 /**
  * Add our custom stylesheets and scripts
  */
 function scripts()
 {
     $options = get_option('maera_admin_options', array());
     $active_shell = isset($options['shell']) ? $options['shell'] : 'core';
     // Remove the default EDD styles
     wp_dequeue_style('edd-styles');
     // If EDD-Software-Specs is installed, remove its styles
     if (class_exists('EDD_Software_Specs')) {
         wp_dequeue_style('edd-software-specs');
         wp_deregister_style('edd-software-specs');
     }
     // Add our custom styles
     wp_register_style('maera-edd', trailingslashit(get_template_directory_uri()) . 'assets/css/edd/style.css');
     wp_enqueue_style('maera-edd');
     if ('isotope' == get_theme_mod('filter_mode', 'isotope') && (is_archive('download') || is_tax('download_tag') || is_tax('download_category'))) {
         // Register && Enqueue Isotope
         wp_register_script('maera_isotope', trailingslashit(get_template_directory_uri()) . 'assets/vendor/jquery.isotope.min.js', false, null, true);
         wp_enqueue_script('maera_isotope');
         // Register && Enqueue Isotope-Sloppy-Masonry
         wp_register_script('maera_isotope_sloppy_masonry', trailingslashit(get_template_directory_uri()) . 'assets/vendor/jquery.isotope.sloppy-masonry.min.js', false, null, true);
         wp_enqueue_script('maera_isotope_sloppy_masonry');
         wp_enqueue_script('edd_script', trailingslashit(get_template_directory_uri()) . 'assets/js/edd-scripts.js', false, null, true);
         // wp_localize_script( 'maera_foundation_script', 'maera_foundation_script_vars', array(
         //
         //     )
         // );
     }
 }
Esempio n. 27
0
 /**
  * Prints HTML with meta information for the current post-date/time, author, comment count and categories.
  */
 function ultra_posted_on()
 {
     echo '<div class="entry-meta-inner">';
     if (is_sticky() && is_home() && !is_paged()) {
         echo '<span class="featured-post">' . __('Sticky', 'ultra') . '</span>';
     }
     if (is_home() && siteorigin_setting('blog_post_date') || is_archive() && siteorigin_setting('blog_post_date') || is_search() && siteorigin_setting('blog_post_date')) {
         echo '<span class="entry-date"><a href="' . esc_url(get_permalink()) . '" rel="bookmark"><time class="published" datetime="' . esc_attr(get_the_date('c')) . '">' . esc_html(get_the_date('j F Y')) . '</time><time class="updated" datetime="' . esc_attr(get_the_modified_date('c')) . '">' . esc_html(get_the_modified_date()) . '</time></span></a>';
     }
     if (is_single() && siteorigin_setting('blog_post_date')) {
         echo '<span class="entry-date"><time class="published" datetime="' . esc_attr(get_the_date('c')) . '">' . esc_html(get_the_date('j F Y')) . '</time><time class="updated" datetime="' . esc_attr(get_the_modified_date('c')) . '">' . esc_html(get_the_modified_date()) . '</time></span>';
     }
     if (siteorigin_setting('blog_post_author')) {
         echo '<span class="byline"><span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '" rel="author">' . esc_html(get_the_author()) . '</a></span></span>';
     }
     if (comments_open() && siteorigin_setting('blog_post_comment_count')) {
         echo '<span class="comments-link">';
         comments_popup_link(__('Leave a comment', 'ultra'), __('1 Comment', 'ultra'), __('% Comments', 'ultra'));
         echo '</span>';
     }
     echo '</div>';
     if (is_single() && siteorigin_setting('navigation_post_nav')) {
         the_post_navigation($args = array('prev_text' => '', 'next_text' => ''));
     }
 }
Esempio n. 28
0
/**
 * Page titles
 */
function stachestack_title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            $title = get_the_title(get_option('page_for_posts', true));
        } else {
            $title = __('Latest Posts', 'stachestack');
        }
    } elseif (is_archive()) {
        $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
        if ($term) {
            $title = apply_filters('single_term_title', $term->name);
        } elseif (is_post_type_archive()) {
            $title = apply_filters('the_title', get_queried_object()->labels->name);
        } elseif (is_day()) {
            $title = sprintf(__('Daily Archives: %s', 'stachestack'), get_the_date());
        } elseif (is_month()) {
            $title = sprintf(__('Monthly Archives: %s', 'stachestack'), get_the_date('F Y'));
        } elseif (is_year()) {
            $title = sprintf(__('Yearly Archives: %s', 'stachestack'), get_the_date('Y'));
        } elseif (is_author()) {
            $title = sprintf(__('Author Archives: %s', 'stachestack'), get_queried_object()->display_name);
        } else {
            $title = single_cat_title('', false);
        }
    } elseif (is_search()) {
        $title = sprintf(__('Search Results for %s', 'stachestack'), get_search_query());
    } elseif (is_404()) {
        $title = __('Not Found', 'stachestack');
    } else {
        $title = get_the_title();
    }
    return apply_filters('stachestack_title', $title);
}
Esempio n. 29
0
function recipress_output()
{
    // determine where to output
    $output = false;
    $outputs = recipress_options('output');
    if (!isset($outputs)) {
        if (is_single()) {
            $output = true;
        }
    } else {
        if (is_home() && in_array('home', $outputs)) {
            $output = true;
        }
        if (is_single() && in_array('single', $outputs)) {
            $output = true;
        }
        if (is_archive() && in_array('archive', $outputs)) {
            $output = true;
        }
        if (is_search() && in_array('search', $outputs)) {
            $output = true;
        }
    }
    return $output;
}
function meanthemes_load_js()
{
    wp_register_style('meanmenu', get_template_directory_uri() . '/assets/js/plugins/meanmenu.min.css', array(), '1.0.7', 'screen', 'meanmenu');
    wp_register_script('meanmenu', get_template_directory_uri() . '/assets/js/plugins/jquery.meanmenu.min.js', array('jquery'), '2.0.8', true);
    wp_register_script('jplayer', get_template_directory_uri() . '/assets/js/plugins/jquery.jplayer.min.js', array('jquery'), '1.0.0', true);
    wp_register_script('flexslider', get_template_directory_uri() . '/assets/js/plugins/jquery.flexslider-min.js', array('jquery'), '1.0.0', true);
    wp_register_script('slabtext', get_template_directory_uri() . '/assets/js/plugins/jquery.slabtext.min.js', array('jquery'), '2.3', true);
    wp_register_script('global', get_template_directory_uri() . '/assets/js/plugins/global-plugins.min.js', array('jquery'), MEANTHEMES_THEME_VER, false);
    wp_register_script('mt-scripts', get_template_directory_uri() . '/assets/js/scripts.min.js', array('jquery', 'global'), MEANTHEMES_THEME_VER, true);
    if (is_single() || is_archive() || is_search() || is_author() || is_front_page() || is_page_template('t-index.php')) {
        wp_enqueue_script('jplayer');
        wp_enqueue_script('flexslider');
    }
    if (is_home() || is_404()) {
        wp_enqueue_script('slabtext');
    }
    if (!is_home() || !is_404()) {
        wp_enqueue_style('webfonts');
    }
    // Check theme options for using a standard menu
    if (get_theme_mod('use_standard_menu', '0') == '1') {
        wp_enqueue_style('meanmenu');
        wp_enqueue_script('meanmenu');
    }
    // load on all pages
    wp_enqueue_script('global');
    wp_enqueue_script('mt-scripts');
}