function webdados_fb_open_graph()
{
    global $webdados_fb_open_graph_plugin_settings, $webdados_fb_open_graph_plugin_name, $webdados_fb_open_graph_plugin_version, $webdados_fb_open_graph_settings;
    //Upgrade
    webdados_fb_open_graph_upgrade();
    //Get options - OLD (until 0.5.4)
    /*foreach($webdados_fb_open_graph_plugin_settings as $key) {
    		$$key=get_option('wonderm00n_open_graph_'.$key);
    	}*/
    //Get options - NEW (after 0.5.4)
    extract($webdados_fb_open_graph_settings);
    //Also set Title Tag?
    $fb_set_title_tag = 0;
    //Additional images
    $fb_image_additional = array();
    $fb_type = 'article';
    if (is_singular()) {
        //It's a Post or a Page or an attachment page - It can also be the homepage if it's set as a page
        global $post;
        $fb_title = esc_attr(strip_tags(stripslashes($post->post_title)));
        //SubHeading
        if ($fb_show_subheading == 1) {
            if (webdados_fb_open_graph_subheadingactive()) {
                $fb_title .= ' - ' . get_the_subheading();
            }
        }
        $fb_url = get_permalink();
        if (is_front_page()) {
            /* Fix homepage type when it's a static page */
            $fb_url = get_option('home') . (intval($fb_url_add_trailing) == 1 ? '/' : '');
            $fb_type = trim($fb_type_homepage == '' ? 'website' : $fb_type_homepage);
        }
        if (trim($post->post_excerpt) != '') {
            //If there's an excerpt that's what we'll use
            $fb_desc = trim($post->post_excerpt);
        } else {
            //If not we grab it from the content
            $fb_desc = trim($post->post_content);
        }
        $fb_desc = intval($fb_desc_chars) > 0 ? mb_substr(esc_attr(strip_tags(strip_shortcodes(stripslashes($fb_desc)))), 0, $fb_desc_chars) : esc_attr(strip_tags(strip_shortcodes(stripslashes($fb_desc))));
        if (intval($fb_image_show) == 1 || intval($fb_image_show_schema) == 1 || intval($fb_image_show_twitter) == 1) {
            $fb_image = webdados_fb_open_graph_post_image($fb_image_use_specific, $fb_image_use_featured, $fb_image_use_content, $fb_image_use_media, $fb_image_use_default, $fb_image);
        }
        //Author
        $author_id = $post->post_author;
        if ($author_id > 0) {
            $fb_author = get_the_author_meta('facebook', $author_id);
            $fb_author_meta = get_the_author_meta('display_name', $author_id);
            $fb_author_linkrelgp = get_the_author_meta('googleplus', $author_id);
            $fb_author_twitter = get_the_author_meta('twitter', $author_id);
        } else {
            $fb_author = '';
            $fb_author_meta = '';
            $fb_author_linkrelgp = '';
            $fb_author_twitter = '';
        }
        //Author - Hide on pages?
        if (is_page() && $fb_author_hide_on_pages == 1) {
            $fb_author = '';
            $fb_author_meta = '';
            $fb_author_linkrelgp = '';
            $fb_author_twitter = '';
        }
        //Published and Modified time
        if (is_singular('post')) {
            $fb_article_pub_date = get_the_date('c');
            $fb_article_mod_date = get_the_modified_date('c');
        } else {
            $fb_article_dates_show = 0;
            $fb_article_pub_date = '';
            $fb_article_mod_date = '';
        }
        //Categories
        if (is_singular('post')) {
            $cats = get_the_category();
            if (!is_wp_error($cats) && (is_array($cats) && count($cats) > 0)) {
                $fb_sections = array();
                foreach ($cats as $cat) {
                    $fb_sections[] = $cat->name;
                }
            }
        } else {
            $fb_article_sections_show = 0;
        }
        //Business Directory Plugin
        if ($fb_show_businessdirectoryplugin == 1) {
            @(include_once ABSPATH . 'wp-admin/includes/plugin.php');
            if (is_plugin_active('business-directory-plugin/wpbusdirman.php')) {
                global $wpbdp;
                //$bdpaction = _wpbdp_current_action();
                $bdpaction = $wpbdp->controller->get_current_action();
                switch ($bdpaction) {
                    case 'showlisting':
                        //Listing
                        $listing_id = get_query_var('listing') ? wpbdp_get_post_by_slug(get_query_var('listing'))->ID : wpbdp_getv($_GET, 'id', get_query_var('id'));
                        $bdppost = get_post($listing_id);
                        $fb_title = esc_attr(strip_tags(stripslashes($bdppost->post_title))) . ' - ' . $fb_title;
                        $fb_set_title_tag = 1;
                        $fb_url = get_permalink($listing_id);
                        if (trim($bdppost->post_excerpt) != '') {
                            //If there's an excerpt that's what we'll use
                            $fb_desc = trim($bdppost->post_excerpt);
                        } else {
                            //If not we grab it from the content
                            $fb_desc = trim($bdppost->post_content);
                        }
                        $fb_desc = intval($fb_desc_chars) > 0 ? mb_substr(esc_attr(strip_tags(strip_shortcodes(stripslashes($fb_desc)))), 0, $fb_desc_chars) : esc_attr(strip_tags(strip_shortcodes(stripslashes($fb_desc))));
                        if (intval($fb_image_show) == 1 || intval($fb_image_show_schema) == 1 || intval($fb_image_show_twitter) == 1) {
                            $thumbdone = false;
                            if (intval($fb_image_use_featured) == 1) {
                                //Featured
                                if ($id_attachment = get_post_thumbnail_id($bdppost->ID)) {
                                    //There's a featured/thumbnail image for this listing
                                    $fb_image = wp_get_attachment_url($id_attachment, false);
                                    $thumbdone = true;
                                }
                            }
                            if (!$thumbdone) {
                                //Main image loaded
                                if ($thumbnail_id = wpbdp_listings_api()->get_thumbnail_id($bdppost->ID)) {
                                    $fb_image = wp_get_attachment_url($thumbnail_id, false);
                                }
                            }
                        }
                        break;
                    case 'browsecategory':
                        //Categories
                        $term = get_term_by('slug', get_query_var('category'), wpbdp_categories_taxonomy());
                        $fb_title = esc_attr(strip_tags(stripslashes($term->name))) . ' - ' . $fb_title;
                        $fb_set_title_tag = 1;
                        $fb_url = get_term_link($term);
                        if (trim($term->description) != '') {
                            $fb_desc = trim($term->description);
                        }
                        break;
                    case 'main':
                        //Main page
                        //No changes
                        break;
                    default:
                        //No changes
                        break;
                }
            }
        }
    } else {
        global $wp_query;
        //Other pages - Defaults
        $fb_title = esc_attr(strip_tags(stripslashes(get_bloginfo('name'))));
        //$fb_url=get_option('home').(intval($fb_url_add_trailing)==1 ? '/' : ''); //2013-11-4 changed from 'siteurl' to 'home'
        $fb_url = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
        //Not really canonical but will work for now
        //These are only used in posts/pages
        $fb_article_sections_show = 0;
        $fb_article_dates_show = 0;
        $fb_author_show = 0;
        $fb_author_show_meta = 0;
        $fb_author_show_linkrelgp = 0;
        $fb_author_show_twitter = 0;
        switch (trim($fb_desc_homepage)) {
            case 'custom':
                $fb_desc = esc_attr(strip_tags(stripslashes($fb_desc_homepage_customtext)));
                //WPML?
                if (function_exists('icl_object_id') && function_exists('icl_register_string')) {
                    global $sitepress;
                    if (ICL_LANGUAGE_CODE != $sitepress->get_default_language()) {
                        $fb_desc = icl_t('wd-fb-og', 'wd_fb_og_desc_homepage_customtext', $fb_desc);
                    } else {
                        //We got it already
                    }
                }
                break;
            default:
                $fb_desc = esc_attr(strip_tags(stripslashes(get_bloginfo('description'))));
                break;
        }
        if (is_category()) {
            $fb_title = esc_attr(strip_tags(stripslashes(single_cat_title('', false))));
            $term = $wp_query->get_queried_object();
            $fb_url = get_term_link($term, $term->taxonomy);
            $cat_desc = trim(esc_attr(strip_tags(stripslashes(category_description()))));
            if (trim($cat_desc) != '') {
                $fb_desc = $cat_desc;
            }
        } else {
            if (is_tag()) {
                $fb_title = esc_attr(strip_tags(stripslashes(single_tag_title('', false))));
                $term = $wp_query->get_queried_object();
                $fb_url = get_term_link($term, $term->taxonomy);
                $tag_desc = trim(esc_attr(strip_tags(stripslashes(tag_description()))));
                if (trim($tag_desc) != '') {
                    $fb_desc = $tag_desc;
                }
            } else {
                if (is_tax()) {
                    $fb_title = esc_attr(strip_tags(stripslashes(single_term_title('', false))));
                    $term = $wp_query->get_queried_object();
                    $fb_url = get_term_link($term, $term->taxonomy);
                    //WooCommerce
                    if (intval($fb_image_show) == 1 || intval($fb_image_show_schema) == 1 || intval($fb_image_show_twitter) == 1) {
                        if (class_exists('woocommerce') && $fb_wc_usecategthumb == 1 && is_product_category()) {
                            if ($thumbnail_id = get_woocommerce_term_meta($term->term_id, 'thumbnail_id', true)) {
                                if ($image = wp_get_attachment_url($thumbnail_id)) {
                                    $fb_image = $image;
                                }
                            }
                        }
                    }
                } else {
                    if (is_search()) {
                        $fb_title = esc_attr(strip_tags(stripslashes(__('Search for') . ' "' . get_search_query() . '"')));
                        $fb_url = get_search_link();
                    } else {
                        if (is_author()) {
                            $fb_title = esc_attr(strip_tags(stripslashes(get_the_author_meta('display_name', get_query_var('author')))));
                            $fb_url = get_author_posts_url(get_query_var('author'), get_query_var('author_name'));
                        } else {
                            if (is_archive()) {
                                if (is_day()) {
                                    $fb_title = esc_attr(strip_tags(stripslashes(get_query_var('day') . ' ' . single_month_title(' ', false) . ' ' . __('Archives'))));
                                    $fb_url = get_day_link(get_query_var('year'), get_query_var('monthnum'), get_query_var('day'));
                                } else {
                                    if (is_month()) {
                                        $fb_title = esc_attr(strip_tags(stripslashes(single_month_title(' ', false) . ' ' . __('Archives'))));
                                        $fb_url = get_month_link(get_query_var('year'), get_query_var('monthnum'));
                                    } else {
                                        if (is_year()) {
                                            $fb_title = esc_attr(strip_tags(stripslashes(get_query_var('year') . ' ' . __('Archives'))));
                                            $fb_url = get_year_link(get_query_var('year'));
                                        }
                                    }
                                }
                            } else {
                                if (is_front_page()) {
                                    $fb_url = get_option('home') . (intval($fb_url_add_trailing) == 1 ? '/' : '');
                                    $fb_type = trim($fb_type_homepage == '' ? 'website' : $fb_type_homepage);
                                } else {
                                    //Others... Defaults already set up there
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    //If no description let's just add the title
    if (trim($fb_desc) == '') {
        $fb_desc = $fb_title;
    }
    //YOAST?
    if ($fb_show_wpseoyoast == 1) {
        if (defined('WPSEO_VERSION')) {
            $wpseo = WPSEO_Frontend::get_instance();
            //App ID - From our plugin
            //Admin ID - From our plugin
            //Locale - From our plugin
            //Sitename - From our plugin
            //Title - From WPSEO
            $fb_title = strip_tags($wpseo->title(false));
            //Title - SubHeading plugin
            if ($fb_show_subheading == 1) {
                if (webdados_fb_open_graph_subheadingactive()) {
                    $fb_title .= ' - ' . get_the_subheading();
                }
            }
            //URL - From WPSEO
            $fb_url = $wpseo->canonical(false);
            //Description - From WPSEO or our plugin
            $fb_desc_temp = $wpseo->metadesc(false);
            $fb_desc = strip_tags(trim($fb_desc_temp) != '' ? trim($fb_desc_temp) : $fb_desc);
            //Image - From our plugin
        }
    }
    //WooCommerce - Additional product images?
    if (intval($fb_image_show) == 1 && class_exists('woocommerce') && $fb_wc_useproductgallery == 1 && is_product()) {
        global $post;
        $product = new WC_Product($post->ID);
        if ($attachment_ids = $product->get_gallery_attachment_ids()) {
            foreach ($attachment_ids as $attachment_id) {
                if ($image_link = wp_get_attachment_url($attachment_id)) {
                    if (trim($image_link) != '') {
                        $fb_image_additional[] = trim($image_link);
                    }
                }
            }
        }
    }
    //Apply Filters
    $fb_title = apply_filters('fb_og_title', $fb_title);
    $fb_desc = apply_filters('fb_og_desc', $fb_desc);
    $fb_image = apply_filters('fb_og_image', $fb_image);
    $fb_image_additional = apply_filters('fb_og_image_additional', $fb_image_additional);
    $fb_locale = apply_filters('fb_og_locale', $fb_locale);
    $fb_image_size = false;
    if (intval($fb_image_show) == 1 && trim($fb_image) != '') {
        if (intval($fb_image_size_show) == 1) {
            if (isset($GLOBALS['webdados_fb_img_size'])) {
                //Already fetched
                $fb_image_size = $GLOBALS['webdados_fb_img_size'];
            } else {
                $fb_image_size = webdados_fb_open_graph_getimagesize($fb_image);
            }
        }
    } else {
        $fb_image_size_show = 0;
    }
    //No spaces on URLs
    if (isset($fb_url) && trim($fb_url) != '') {
        $fb_url = str_replace(' ', '%20', trim($fb_url));
    }
    if (isset($fb_publisher) && trim($fb_publisher) != '') {
        $fb_publisher = str_replace(' ', '%20', trim($fb_publisher));
    }
    if (isset($fb_publisher_schema) && trim($fb_publisher_schema) != '') {
        $fb_publisher_schema = str_replace(' ', '%20', trim($fb_publisher_schema));
    }
    if (isset($fb_author) && trim($fb_author) != '') {
        $fb_author = str_replace(' ', '%20', trim($fb_author));
    }
    if (isset($fb_author_linkrelgp) && trim($fb_author_linkrelgp) != '') {
        $fb_author_linkrelgp = str_replace(' ', '%20', trim($fb_author_linkrelgp));
    }
    if (isset($fb_image) && trim($fb_image) != '') {
        $fb_image = str_replace(' ', '%20', trim($fb_image));
    }
    if (isset($fb_image_additional) && is_array($fb_image_additional) && count($fb_image_additional)) {
        foreach ($fb_image_additional as $key => $value) {
            $fb_image_additional[$key] = str_replace(' ', '%20', trim($value));
        }
    }
    $html = '
<!-- START - ' . $webdados_fb_open_graph_plugin_name . ' ' . $webdados_fb_open_graph_plugin_version . ' -->
';
    if (intval($fb_app_id_show) == 1 && trim($fb_app_id) != '') {
        $html .= '<meta property="fb:app_id" content="' . trim(esc_attr($fb_app_id)) . '"/>
';
    }
    if (intval($fb_admin_id_show) == 1 && trim($fb_admin_id) != '') {
        $html .= '<meta property="fb:admins" content="' . trim(esc_attr($fb_admin_id)) . '"/>
';
    }
    if (intval($fb_locale_show) == 1) {
        $html .= '<meta property="og:locale" content="' . trim(esc_attr(trim($fb_locale) != '' ? trim($fb_locale) : trim(get_locale()))) . '"/>
';
    }
    if (intval($fb_sitename_show) == 1) {
        $html .= '<meta property="og:site_name" content="' . trim(esc_attr(get_bloginfo('name'))) . '"/>
';
    }
    if (intval($fb_title_show) == 1) {
        $html .= '<meta property="og:title" content="' . trim(esc_attr($fb_title)) . '"/>
';
    }
    if (intval($fb_set_title_tag) == 1) {
        //Does nothing so far. We try to create the <title> tag but it's too late now
    }
    if (intval($fb_title_show_schema) == 1) {
        $html .= '<meta itemprop="name" content="' . trim(esc_attr($fb_title)) . '"/>
';
    }
    if (intval($fb_title_show_twitter) == 1) {
        $html .= '<meta name="twitter:title" content="' . trim(esc_attr($fb_title)) . '"/>
';
    }
    if (intval($fb_url_show) == 1) {
        $html .= '<meta property="og:url" content="' . trim(esc_attr($fb_url)) . '"/>
';
    }
    if (intval($fb_url_show_twitter) == 1) {
        $html .= '<meta name="twitter:url" content="' . trim(esc_attr($fb_url)) . '"/>
';
    }
    if (intval($fb_url_canonical) == 1) {
        $html .= '<link rel="canonical" href="' . trim(esc_attr($fb_url)) . '"/>
';
    }
    if (intval($fb_type_show) == 1) {
        $html .= '<meta property="og:type" content="' . trim(esc_attr($fb_type)) . '"/>
';
    }
    if (intval($fb_article_dates_show) == 1 && trim($fb_article_pub_date) != '') {
        $html .= '<meta property="article:published_time" content="' . trim(esc_attr($fb_article_pub_date)) . '"/>
';
    }
    if (intval($fb_article_dates_show) == 1 && trim($fb_article_mod_date) != '') {
        $html .= '<meta property="article:modified_time" content="' . trim(esc_attr($fb_article_mod_date)) . '" />
<meta property="og:updated_time" content="' . trim(esc_attr($fb_article_mod_date)) . '" />
';
    }
    if (intval($fb_article_sections_show) == 1 && isset($fb_sections) && is_array($fb_sections) && count($fb_sections) > 0) {
        foreach ($fb_sections as $fb_section) {
            $html .= '<meta property="article:section" content="' . trim(esc_attr($fb_section)) . '"/>
';
        }
    }
    if (intval($fb_publisher_show) == 1 && trim($fb_publisher) != '') {
        $html .= '<meta property="article:publisher" content="' . trim(esc_attr($fb_publisher)) . '"/>
';
    }
    if (intval($fb_publisher_show_schema) == 1 && trim($fb_publisher_schema) != '') {
        $html .= '<link rel="publisher" href="' . trim(esc_attr($fb_publisher_schema)) . '"/>
';
    }
    if (intval($fb_publisher_show_twitter) == 1 && trim($fb_publisher_twitteruser) != '') {
        $html .= '<meta name="twitter:site" content="@' . trim(esc_attr($fb_publisher_twitteruser)) . '"/>
';
    }
    if (intval($fb_author_show) == 1 && $fb_author != '') {
        $html .= '<meta property="article:author" content="' . trim(esc_attr($fb_author)) . '"/>
';
    }
    if (intval($fb_author_show_meta) == 1 && $fb_author_meta != '') {
        $html .= '<meta name="author" content="' . trim(esc_attr($fb_author_meta)) . '"/>
';
    }
    if (intval($fb_author_show_linkrelgp) == 1 && trim($fb_author_linkrelgp) != '') {
        $html .= '<link rel="author" href="' . trim(esc_attr($fb_author_linkrelgp)) . '"/>
';
    }
    if (intval($fb_author_show_twitter) == 1 && (trim($fb_author_twitter) != '' || trim($fb_publisher_twitteruser) != '')) {
        $html .= '<meta name="twitter:creator" content="@' . trim(esc_attr(trim($fb_author_twitter) != '' ? trim($fb_author_twitter) : trim($fb_publisher_twitteruser))) . '"/>
';
    }
    if (intval($fb_desc_show) == 1) {
        $html .= '<meta property="og:description" content="' . trim(esc_attr($fb_desc)) . '"/>
';
    }
    if (intval($fb_desc_show_meta) == 1) {
        $html .= '<meta name="description" content="' . trim(esc_attr($fb_desc)) . '"/>
';
    }
    if (intval($fb_desc_show_schema) == 1) {
        $html .= '<meta itemprop="description" content="' . trim(esc_attr($fb_desc)) . '"/>
';
    }
    if (intval($fb_desc_show_twitter) == 1) {
        $html .= '<meta name="twitter:description" content="' . trim(esc_attr($fb_desc)) . '"/>
';
    }
    if (intval($fb_image_show) == 1 && trim($fb_image) != '') {
        $html .= '<meta property="og:image" content="' . trim(esc_attr($fb_image)) . '"/>
';
    }
    if (intval($fb_image_show) == 1 && isset($fb_image_additional) && is_array($fb_image_additional) && count($fb_image_additional) > 0) {
        foreach ($fb_image_additional as $fb_image_additional_temp) {
            $html .= '<meta property="og:image" content="' . trim(esc_attr($fb_image_additional_temp)) . '"/>
';
        }
    } else {
        //We only show the image size if we only have one image
        if (intval($fb_image_size_show) == 1 && isset($fb_image_size) && is_array($fb_image_size) != '') {
            $html .= '<meta property="og:image:width" content="' . intval(esc_attr($fb_image_size[0])) . '"/>
<meta property="og:image:height" content="' . intval(esc_attr($fb_image_size[1])) . '"/>
';
        }
    }
    if (intval($fb_image_show_schema) == 1 && trim($fb_image) != '') {
        $html .= '<meta itemprop="image" content="' . trim(esc_attr($fb_image)) . '"/>
';
    }
    if (intval($fb_image_show_twitter) == 1 && trim($fb_image) != '') {
        $html .= '<meta name="twitter:image:src" content="' . trim(esc_attr($fb_image)) . '"/>
';
    }
    if (intval($fb_title_show_twitter) == 1 || intval($fb_url_show_twitter) == 1 || $fb_author_show_twitter == 1 || $fb_publisher_show_twitter == 1 || $fb_image_show_twitter == 1) {
        $html .= '<meta name="twitter:card" content="' . trim(esc_attr($fb_twitter_card_type)) . '"/>
';
    }
    $html .= '<!-- END - ' . $webdados_fb_open_graph_plugin_name . ' -->

';
    echo $html;
}
function smarty_single_month_title($params)
{
    $display = '';
    $prefix = '';
    extract($params);
    return single_month_title($prefix, $display);
}
Example #3
0
/**
 * Returns the document title.
 *
 * The order (site name first or last) can be set on the Tarski Options page.
 * While the function ultimately returns a string, please note that filters
 * are applied to an array! This allows plugins to easily alter any aspect
 * of the title. For example, one might write a plugin to change the separator.
 *
 * @since 1.5
 * @deprecated 3.2.0
 *
 * @param string $sep
 * @return string
 *
 * @hook filter tarski_doctitle
 * Filter document titles.
 */
function tarski_doctitle($sep = '&middot;')
{
    _deprecated_function('wp_title', '3.2.0');
    $site_name = get_bloginfo('name');
    $content = trim(wp_title('', false));
    if (is_404()) {
        $content = sprintf(__('Error %s', 'tarski'), '404');
    } elseif (get_option('show_on_front') == 'posts' && is_home()) {
        $content = get_bloginfo('description', 'display');
    } elseif (is_search()) {
        $content = sprintf(__('Search results for %s', 'tarski'), esc_html(get_search_query()));
    } elseif (is_month()) {
        $content = single_month_title(' ', false);
    } elseif (is_tag()) {
        $content = multiple_tag_titles();
    }
    $elements = strlen($content) > 0 ? array('site_name' => $site_name, 'separator' => $sep, 'content' => $content) : array('site_name' => $site_name);
    if (get_tarski_option('swap_title_order')) {
        $elements = array_reverse($elements, true);
    }
    // Filters should return an array
    $elements = apply_filters('tarski_doctitle', $elements);
    // But if they don't, it won't try to implode
    if (is_array($elements)) {
        $doctitle = implode(' ', $elements);
    }
    echo $doctitle;
}
Example #4
0
/**
 * Creates the document title.
 *
 * The order (site name first or last) can be set on the Tarski Options page.
 * While the function ultimately returns a string, please note that filters
 * are applied to an array! This allows plugins to easily alter any aspect
 * of the title. For example, one might write a plugin to change the separator.
 *
 * @since 1.5
 *
 * @param string $sep
 * @return string
 *
 * @hook filter tarski_doctitle
 * Filter document titles.
 */
function tarski_document_title($title, $sep, $seplocation)
{
    $title = trim($title);
    $sitename = get_bloginfo('name');
    $enc = get_option('blog_charset');
    if (!(isset($enc) && strlen($enc) > 0)) {
        $enc = "utf-8";
    }
    $slen = mb_strlen($sep, $enc);
    $tlen = mb_strlen($title, $enc);
    if ($seplocation == 'right') {
        $doctitle = mb_substr($title, 0, $tlen - $slen, $enc);
    } else {
        $doctitle = mb_substr($title, $slen, $tlen - $slen, $enc);
    }
    $doctitle = trim($doctitle);
    if (is_404()) {
        $doctitle = sprintf(__('Error %s', 'tarski'), '404');
    } elseif (get_option('show_on_front') == 'posts' && is_home()) {
        $doctitle = get_bloginfo('description', 'display');
    } elseif (is_search()) {
        $doctitle = sprintf(__('Search results for %s', 'tarski'), esc_html(get_search_query()));
    } elseif (is_month()) {
        $doctitle = single_month_title(' ', false);
    } elseif (is_tag()) {
        $doctitle = multiple_tag_titles();
    }
    $title = array($sitename, $sep, $doctitle);
    if (get_tarski_option('swap_title_order')) {
        $title = array_reverse($title);
    }
    return implode(" ", $title);
}
 function getPost()
 {
     $data = new stdClass();
     $categoryId = (int) get_query_var('cat');
     if (is_tag()) {
         $data->post = get_post(ThemeOption::getOption('blog_search_post_id'));
         $tagQuery = get_query_var('tag');
         $tagData = get_tags(array('slug' => $tagQuery));
         $data->post->post_title = esc_html($tagData[0]->name);
     } elseif (is_category($categoryId)) {
         $category = get_category($categoryId);
         $data->post = get_post(ThemeOption::getOption('blog_category_post_id'));
         $data->post->post_title = ThemeHelper::esc_html($category->name);
     } elseif (is_day()) {
         $data->post = get_post(ThemeOption::getOption('blog_archive_post_id'));
         $data->post->post_title = get_the_date();
     } elseif (is_archive()) {
         $data->post = get_post(ThemeOption::getOption('blog_archive_post_id'));
         $data->post->post_title = single_month_title(' ', false);
     } elseif (is_search()) {
         $data->post = get_post(ThemeOption::getOption('blog_search_post_id'));
         $data->post->post_title = sprintf(__('Search result for phrase <i>%s</i>', THEME_DOMAIN), esc_html(get_query_var('s')));
     } elseif (is_404()) {
         $data->post = get_post(ThemeOption::getOption('page_404_page_id'));
         $data->post->post_title = $data->post->post_title;
     } else {
         return false;
     }
     return $data;
 }
Example #6
0
/**
 * tarski_doctitle() - Returns the document title.
 * 
 * The order (site name first or last) can be set on the Tarski Options page.
 * While the function ultimately returns a string, please note that filters
 * are applied to an array! This allows plugins to easily alter any aspect
 * of the title. For example, one might write a plugin to change the separator.
 * @since 1.5
 * @param string $sep
 * @return string $doctitle
 * @hook filter tarski_doctitle
 * Filter document titles.
 */
function tarski_doctitle($sep = '&middot;')
{
    $site_name = get_bloginfo('name');
    if (is_404()) {
        $content = __(sprintf('Error %s', '404'), 'tarski');
    } elseif (get_option('show_on_front') == 'posts' && is_home()) {
        if (get_bloginfo('description')) {
            $content = get_bloginfo('description');
        }
    } elseif (is_search()) {
        $content = sprintf(__('Search results for %s', 'tarski'), attribute_escape(get_search_query()));
    } elseif (is_month()) {
        $content = single_month_title(' ', false);
    } elseif (is_tag()) {
        $content = multiple_tag_titles();
    } else {
        $content = trim(wp_title('', false));
    }
    if ($content) {
        $elements = array('site_name' => $site_name, 'separator' => $sep, 'content' => $content);
    } else {
        $elements = array('site_name' => $site_name);
    }
    if (get_tarski_option('swap_title_order')) {
        $elements = array_reverse($elements, true);
    }
    // Filters should return an array
    $elements = apply_filters('tarski_doctitle', $elements);
    // But if they don't, it won't try to implode
    if (check_input($elements, 'array')) {
        $doctitle = implode(' ', $elements);
    }
    echo $doctitle;
}
Example #7
0
/**
 * Breadcrumbs
 * @return html
 * @source http://yootheme.com (Warp Themes)
 */
function basey_breadcrumbs()
{
    global $wp_query;
    if (!is_home() && !is_front_page()) {
        $output = '<ul class="zz-link-more-muted zz-text-more-muted zz-position-up uk-breadcrumb uk-hidden-small">';
        $output .= '<li><a href="' . get_option('home') . '">Home</a></li>';
        if (is_single()) {
            $cats = get_the_category();
            if ($cats) {
                $cat = $cats[0];
                if (is_object($cat)) {
                    if ($cat->parent != 0) {
                        $cats = explode("@@@", get_category_parents($cat->term_id, true, "@@@"));
                        unset($cats[count($cats) - 1]);
                        $output .= str_replace('<li>@@', '<li>', '<li>' . implode("</li><li>", $cats) . '</li>');
                    } else {
                        $output .= '<li><a href="' . get_category_link($cat->term_id) . '">' . $cat->name . '</a></li>';
                    }
                }
            }
        }
        if (is_category()) {
            $cat_obj = $wp_query->get_queried_object();
            $cats = explode("@@@", get_category_parents($cat_obj->term_id, TRUE, '@@@'));
            unset($cats[count($cats) - 1]);
            $cats[count($cats) - 1] = '@@<span>' . strip_tags($cats[count($cats) - 1]) . '</span>';
            $output .= str_replace('<li>@@', '<li class="uk-active">', '<li>' . implode("</li><li>", $cats) . '</li>');
        } elseif (is_tag()) {
            $output .= '<li class="uk-active"><span>' . single_cat_title('', false) . '</span></li>';
        } elseif (is_date()) {
            $output .= '<li class="uk-active"><span>' . single_month_title(' ', false) . '</span></li>';
        } elseif (is_author()) {
            $user = get_user_by('login', get_the_author());
            $output .= '<li class="uk-active"><span>' . $user->display_name . '</span></li>';
        } elseif (is_search()) {
            $output .= '<li class="uk-active"><span>' . stripslashes(strip_tags(get_search_query())) . '</span></li>';
        } elseif (is_tax()) {
            $taxonomy = get_taxonomy(get_query_var('taxonomy'));
            $term = get_query_var('term');
            $output .= '<li class="uk-active"><span>' . $taxonomy->label . ': ' . $term . '</span></li>';
        } else {
            if (!in_array(get_post_type(), array('post', 'page'))) {
                $cpt = get_post_type_object(get_post_type());
                $output .= '<li><a href="' . get_post_type_archive_link(get_post_type()) . '">' . $cpt->labels->name . '</a></li>';
            }
            $ancestors = get_ancestors(get_the_ID(), 'page');
            for ($i = count($ancestors) - 1; $i >= 0; $i--) {
                $output .= '<li><a href="' . get_page_link($ancestors[$i]) . '" title="' . get_the_title($ancestors[$i]) . '">' . get_the_title($ancestors[$i]) . '</a></li>';
            }
            $output .= '<li class="uk-active"><span>' . get_the_title() . '</span></li>';
        }
        $output .= '</ul>';
    } else {
        $output = '<ul class="uk-breadcrumb">';
        $output .= '<li class="uk-active"><span>Home</span></li>';
        $output .= '</ul>';
    }
    echo $output;
}
Example #8
0
/**
 * Filters the `wp_title` output early.
 *
 * @since  0.9.0
 * @access publc
 * @param  string  $title
 * @param  string  $separator
 * @param  string  $seplocation
 * @return string
 */
function omega_wp_title($title, $separator, $seplocation)
{
    if (is_front_page()) {
        $doctitle = get_bloginfo('name') . $separator . ' ' . get_bloginfo('description');
    } elseif (is_home() || is_singular()) {
        $doctitle = single_post_title('', false);
    } elseif (is_category()) {
        $doctitle = single_cat_title('', false);
    } elseif (is_tag()) {
        $doctitle = single_tag_title('', false);
    } elseif (is_tax()) {
        $doctitle = single_term_title('', false);
    } elseif (is_post_type_archive()) {
        $doctitle = post_type_archive_title('', false);
    } elseif (is_author()) {
        $doctitle = get_the_author_meta('display_name', get_query_var('author'));
    } elseif (get_query_var('minute') && get_query_var('hour')) {
        $doctitle = omega_single_minute_hour_title('', false);
    } elseif (get_query_var('minute')) {
        $doctitle = omega_single_minute_title('', false);
    } elseif (get_query_var('hour')) {
        $doctitle = omega_single_hour_title('', false);
    } elseif (is_day()) {
        $doctitle = omega_single_day_title('', false);
    } elseif (get_query_var('w')) {
        $doctitle = omega_single_week_title('', false);
    } elseif (is_month()) {
        $doctitle = single_month_title(' ', false);
    } elseif (is_year()) {
        $doctitle = omega_single_year_title('', false);
    } elseif (is_archive()) {
        $doctitle = omega_single_archive_title('', false);
    } elseif (is_search()) {
        $doctitle = omega_search_title('', false);
    } elseif (is_404()) {
        $doctitle = omega_404_title('', false);
    } else {
        $doctitle = '';
    }
    /* If the current page is a paged page. */
    if ((($page = get_query_var('paged')) || ($page = get_query_var('page'))) && $page > 1) {
        /* Translators: 1 is the page title. 2 is the page number. */
        $doctitle = sprintf(__('%1$s Page %2$s', 'omega'), $doctitle . $separator, number_format_i18n(absint($page)));
    }
    /* Trim separator + space from beginning and end. */
    $doctitle = trim($doctitle, "{$separator} ");
    return $doctitle;
}
 function getPost()
 {
     $data = new stdClass();
     global $post, $wp_query;
     $categoryId = (int) get_query_var('cat');
     if (function_exists('is_woocommerce') && is_woocommerce()) {
         $data->post = get_post(get_option('woocommerce_shop_page_id'));
         if (is_product()) {
             $data->post = $post;
         } elseif (is_product_category() || is_product_tag()) {
             $data->post->post_title = ThemeHelper::esc_html($wp_query->queried_object->name);
         } elseif (is_search()) {
             $data->post->post_title = sprintf(__('Search products for phrase <i>%s</i>', THEME_DOMAIN), esc_html(get_query_var('s')));
         }
         setup_postdata($data->post);
     } else {
         if (is_tag()) {
             $data->post = get_post(ThemeOption::getOption('blog_search_post_id'));
             $tagQuery = get_query_var('tag');
             $tagData = get_tags(array('slug' => $tagQuery));
             $data->post->post_title = esc_html($tagData[0]->name);
         } elseif (is_author()) {
             $author = get_userdata(get_query_var('author'));
             $data->post = get_post(ThemeOption::getOption('blog_author_post_id'));
             $data->post->post_title = sprintf(__('All posts from %s', THEME_DOMAIN), get_the_author_meta('display_name', $author->data->ID));
         } elseif (is_category($categoryId)) {
             $category = get_category($categoryId);
             $data->post = get_post(ThemeOption::getOption('blog_category_post_id'));
             $data->post->post_title = ThemeHelper::esc_html($category->name);
         } elseif (is_day()) {
             $data->post = get_post(ThemeOption::getOption('blog_archive_post_id'));
             $data->post->post_title = get_the_date();
         } elseif (is_archive()) {
             $data->post = get_post(ThemeOption::getOption('blog_archive_post_id'));
             $data->post->post_title = single_month_title(' ', false);
         } elseif (is_search()) {
             $data->post = get_post(ThemeOption::getOption('blog_search_post_id'));
             $data->post->post_title = sprintf(__('Kết quả tìm kiếm: <i>%s</i>', THEME_DOMAIN), esc_html(get_query_var('s')));
         } elseif (is_404()) {
             $data->post = get_post(ThemeOption::getOption('page_404_page_id'));
             $data->post->post_title = $data->post->post_title;
         } else {
             return false;
         }
     }
     return $data;
 }
/**
 * Filters `get_the_archve_title` to add better archive titles than core.
 *
 * @since  1.0.0
 *
 * @param  string  $title
 * @return string
 */
function munsa_lite_archive_title_filter($title)
{
    if (is_home() && !is_front_page()) {
        $title = get_post_field('post_title', get_queried_object_id());
    } elseif (is_category()) {
        $title = single_cat_title('', false);
    } elseif (is_tag()) {
        $title = single_tag_title('', false);
    } elseif (is_tax()) {
        $title = single_term_title('', false);
    } elseif (is_author()) {
        $title = get_the_author_meta('display_name', absint(get_query_var('author')));
    } elseif (is_search()) {
        $title = sprintf(esc_html__('Search results for &#8220;%s&#8221;', 'munsa-lite'), get_search_query());
    } elseif (is_post_type_archive()) {
        $title = post_type_archive_title('', false);
    } elseif (is_month()) {
        $title = single_month_title(' ', false);
    }
    return apply_filters('munsa_lite_archive_title', $title);
}
 /**
  * Add (non-link) month crumb to crumbs property
  */
 private function add_month_crumb()
 {
     $this->add_predefined_crumb($this->options['breadcrumbs-archiveprefix'] . ' ' . esc_html(single_month_title(' ', false)), null, true);
 }
Example #12
0
		<div class="large-12 columns">
	
			
<h1><?php 
    if (is_category()) {
        single_cat_title();
    } elseif (is_tag()) {
        echo __('Archives for ', 'consultant');
        single_tag_title();
    } elseif (is_author()) {
        $curauth = isset($_GET['author_name']) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
        echo __('Archives for ', 'consultant');
        echo $curauth->nickname;
    } elseif (is_archive()) {
        echo __('Archives for ', 'consultant');
        single_month_title(' ', true);
    } else {
        wp_title('', true);
    }
    ?>
</h1>
			
			</div>	
			
	</div></div>
	
<?php 
}
?>

<?php 
Example #13
0
/**
 * {@internal Missing Short Description }}
 * 
 * {@internal Missing Long Description }}
 * 
 * @hook	filter	bf_breadcrumb_prefix
 * @since	0.5.2
 */
function bf_add_breadcrumbs()
{
    /*
     * Taken from Yoast Breadcrumb (http://yoast.com/wordpress/breadcrumbs/).
     * Edited it to display the breadcrumb in a unordered list for certain jQuery plugins to work.
     */
    global $wp_query;
    $output = '';
    $on_front = get_option('show_on_front');
    $output .= '<ul class="breadcrumbs clearfix" id="breadcrumbs">';
    // comment this to hide prefix notice
    //$prefix = apply_filters( 'bf_breadcrumb_prefix', __('You are Here:', 'buffet') );
    if ($prefix != '') {
        $output .= '<li class="notice">' . $prefix . '</li>';
    }
    function bf_get_category_parents($id, $link = false, $separator = '', $nicename = false)
    {
        $chain = '';
        $parent =& get_category($id);
        if (is_wp_error($parent)) {
            return $parent;
        }
        if ($nicename) {
            $name = $parent->slug;
        } else {
            $name = $parent->cat_name;
        }
        if ($parent->parent && $parent->parent != $parent->term_id) {
            $chain .= '<li>' . get_category_parents($parent->parent, true, $separator, $nicename) . '</li>';
        }
        if (is_single()) {
            return $chain . '<li><a href="' . get_category_link($id) . '">' . $name . '</a></li>';
        } else {
            return $chain . '<li><strong>' . $name . '</strong></li>';
        }
    }
    if ($on_front == "page") {
        $homelink = '<li><a href="' . get_permalink(get_option('page_on_front')) . '">' . bf_get_option('home_link') . '</a></li>';
        $bloglink = $homelink . '<li><a href="' . get_permalink(get_option('page_for_posts')) . '">' . bf_get_option('blog_link') . '</a></li>';
    } else {
        $homelink = '<li><a href="' . get_bloginfo('url') . '">' . bf_get_option('home_link') . '</a></li>';
        $bloglink = $homelink;
    }
    if ($on_front == "page" && is_front_page() || $on_front == "posts" && is_home()) {
        $output .= '<li><strong>' . bf_get_option('home_link') . '</strong></li>';
    } elseif ($on_front == "page" && is_home()) {
        $output .= $homelink . '<li><strong>' . bf_get_option('blog_link') . '</strong></li>';
    } elseif (!is_page()) {
        $output .= $homelink;
        if ((is_single() || is_category() || is_tag() || is_date() || is_author()) && bf_get_option('single_parent') != false) {
            $output .= '<li><a href="' . get_permalink(bf_get_option('single_parent')) . '">' . get_the_title(bf_get_option('single_parent')) . '</a></li>';
        }
        if (is_single()) {
            $cats = get_the_category();
            $cat = $cats[0];
            if ($cat->parent != 0) {
                $output .= bf_get_category_parents($cat->term_id, true, "");
            } else {
                $output .= '<li><a href="' . get_category_link($cat->term_id) . '">' . $cat->name . '</a></li>';
            }
        }
        if (is_category()) {
            $cat = intval(get_query_var('cat'));
            $output .= bf_get_category_parents($cat, false, "");
        } elseif (is_tag()) {
            $output .= '<li><strong>' . single_cat_title(' ', false) . '</strong></li>';
        } elseif (is_date()) {
            $output .= '<li><strong>' . single_month_title(' ', false) . '</strong></li>';
        } elseif (is_author()) {
            $user = get_userdatabylogin($wp_query->query_vars['author_name']);
            $output .= '<li><strong>' . $user->display_name . '</strong></li>';
        } elseif (is_search()) {
            $output .= '<li><strong>' . get_search_query() . '</strong></li>';
        } else {
            $output .= '<li><strong>' . get_the_title() . '</strong></li>';
        }
    } else {
        $post = $wp_query->get_queried_object();
        // If this is a top level Page, it's simple to output the breadcrumb
        if (0 == $post->post_parent) {
            $output .= $homelink . '<li><strong>' . get_the_title() . '</strong></li>';
        } else {
            if (isset($post->ancestors)) {
                if (is_array($post->ancestors)) {
                    $ancestors = array_values($post->ancestors);
                } else {
                    $ancestors = array($post->ancestors);
                }
            } else {
                $ancestors = array($post->post_parent);
            }
            // Reverse the order so it's oldest to newest
            $ancestors = array_reverse($ancestors);
            // Add the current Page to the ancestors list (as we need it's title too)
            $ancestors[] = $post->ID;
            $links = array();
            foreach ($ancestors as $ancestor) {
                $tmp = array();
                $tmp['title'] = strip_tags(get_the_title($ancestor));
                $tmp['url'] = get_permalink($ancestor);
                $tmp['cur'] = false;
                if ($ancestor == $post->ID) {
                    $tmp['cur'] = true;
                }
                $links[] = $tmp;
            }
            $output .= $homelink;
            foreach ($links as $link) {
                if (!$link['cur']) {
                    $output .= '<li><a href="' . $link['url'] . '">' . $link['title'] . '</a></li>';
                } else {
                    $output .= '<li><strong>' . $link['title'] . '</strong></li>';
                }
            }
        }
    }
    $output .= '</ul>';
    echo $output;
    // return output
}
Example #14
0
 private function title()
 {
     global $post, $wp_query;
     if (empty($post) && is_singular()) {
         $post = $wp_query->get_queried_object();
     }
     $options = get_wpseo_options();
     if (is_home() && 'posts' == get_option('show_on_front')) {
         if (isset($options['title-home']) && $options['title-home'] != '') {
             $title = wpseo_replace_vars($options['title-home'], array());
         } else {
             $title = get_bloginfo('name');
         }
     } else {
         if (is_home() && 'posts' != get_option('show_on_front')) {
             // For some reason, in some instances is_home returns true for the front page when page_for_posts is not set.
             if (get_option('page_for_posts') == 0) {
                 $post = get_post(get_option('page_on_front'));
             } else {
                 $post = get_post(get_option('page_for_posts'));
             }
             $fixed_title = wpseo_get_value('title');
             if ($fixed_title) {
                 $title = $fixed_title;
             } else {
                 if (isset($options['title-' . $post->post_type]) && !empty($options['title-' . $post->post_type])) {
                     $title = wpseo_replace_vars($options['title-' . $post->post_type], (array) $post);
                 } else {
                     $title = get_bloginfo('name');
                 }
             }
         } else {
             if (is_singular()) {
                 $fixed_title = wpseo_get_value('title');
                 if ($fixed_title) {
                     $title = $fixed_title;
                 } else {
                     if (isset($options['title-' . $post->post_type]) && !empty($options['title-' . $post->post_type])) {
                         $title = wpseo_replace_vars($options['title-' . $post->post_type], (array) $post);
                     } else {
                         $title = get_the_title();
                         $title = apply_filters('single_post_title', $title);
                     }
                 }
             } else {
                 if (is_category() || is_tag() || is_tax()) {
                     $term = $wp_query->get_queried_object();
                     $title = trim(wpseo_get_term_meta($term, $term->taxonomy, 'title'));
                     if (!$title || empty($title)) {
                         if (isset($options['title-' . $term->taxonomy]) && !empty($options['title-' . $term->taxonomy])) {
                             $title = wpseo_replace_vars($options['title-' . $term->taxonomy], (array) $term);
                         } else {
                             if (is_category()) {
                                 $title = single_cat_title('', false);
                             } else {
                                 if (is_tag()) {
                                     $title = single_tag_title('', false);
                                 } else {
                                     if (is_tax()) {
                                         if (function_exists('single_term_title')) {
                                             $title = single_term_title('', false);
                                         } else {
                                             $term = $wp_query->get_queried_object();
                                             $title = $term->name;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 } else {
                     if (is_search()) {
                         if (isset($options['title-search']) && !empty($options['title-search'])) {
                             $title = wpseo_replace_vars($options['title-search'], (array) $wp_query->get_queried_object());
                         } else {
                             $title = __('Search for "') . get_search_query() . '"';
                         }
                     } else {
                         if (is_author()) {
                             $author_id = get_query_var('author');
                             $title = get_the_author_meta('wpseo_title', $author_id);
                             if (empty($title)) {
                                 if (isset($options['title-author']) && !empty($options['title-author'])) {
                                     $title = wpseo_replace_vars($options['title-author'], array());
                                 } else {
                                     $title = get_the_author_meta('display_name', $author_id);
                                 }
                             }
                         } else {
                             if (is_post_type_archive()) {
                                 $post_type = get_post_type();
                                 if (isset($options['title-ptarchive-' . $post_type]) && '' != $options['title-ptarchive-' . $post_type]) {
                                     return $options['title-ptarchive-' . $post_type];
                                 } else {
                                     $post_type_obj = get_post_type_object($post_type);
                                     $title = $post_type_obj->labels->menu_name;
                                 }
                             } else {
                                 if (is_archive()) {
                                     if (isset($options['title-archive']) && !empty($options['title-archive'])) {
                                         $title = wpseo_replace_vars($options['title-archive'], array('post_title' => $title));
                                     } else {
                                         if (is_month()) {
                                             $title = single_month_title(' ', false) . ' ' . __('Archives');
                                         } else {
                                             if (is_year()) {
                                                 $title = get_query_var('year') . ' ' . __('Archives');
                                             }
                                         }
                                     }
                                 } else {
                                     if (is_404()) {
                                         if (isset($options['title-404']) && !empty($options['title-404'])) {
                                             $title = wpseo_replace_vars($options['title-404'], array('post_title' => $title));
                                         } else {
                                             $title = __('Page not found');
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     echo "<meta property='og:title' content='" . esc_attr(strip_tags(stripslashes($title))) . "'/>\n";
 }
Example #15
0
/**
 * @param string $string the string to replace the variables in.
 * @param array  $args   the object some of the replacement values might come from, could be a post, taxonomy or term.
 * @param array  $omit   variables that should not be replaced by this function.
 * @return string
 */
function wpseo_replace_vars($string, $args, $omit = array())
{
    $args = (array) $args;
    $string = strip_tags($string);
    // Let's see if we can bail super early.
    if (strpos($string, '%%') === false) {
        return trim(preg_replace('/\\s+/u', ' ', $string));
    }
    global $sep;
    if (!isset($sep) || empty($sep)) {
        $sep = '-';
    }
    $simple_replacements = array('%%sep%%' => $sep, '%%sitename%%' => get_bloginfo('name'), '%%sitedesc%%' => get_bloginfo('description'), '%%currenttime%%' => date('H:i'), '%%currentdate%%' => date('M jS Y'), '%%currentmonth%%' => date('F'), '%%currentyear%%' => date('Y'));
    foreach ($simple_replacements as $var => $repl) {
        $string = str_replace($var, $repl, $string);
    }
    // Let's see if we can bail early.
    if (strpos($string, '%%') === false) {
        return trim(preg_replace('/\\s+/u', ' ', $string));
    }
    global $wp_query;
    $defaults = array('ID' => '', 'name' => '', 'post_author' => '', 'post_content' => '', 'post_date' => '', 'post_excerpt' => '', 'post_modified' => '', 'post_title' => '', 'taxonomy' => '', 'term_id' => '');
    if (isset($args['post_content'])) {
        $args['post_content'] = wpseo_strip_shortcode($args['post_content']);
    }
    if (isset($args['post_excerpt'])) {
        $args['post_excerpt'] = wpseo_strip_shortcode($args['post_excerpt']);
    }
    $r = (object) wp_parse_args($args, $defaults);
    $max_num_pages = 1;
    if (!is_single()) {
        $pagenum = get_query_var('paged');
        if ($pagenum === 0) {
            $pagenum = 1;
        }
        if (isset($wp_query->max_num_pages) && $wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0) {
            $max_num_pages = $wp_query->max_num_pages;
        }
    } else {
        global $post;
        $pagenum = get_query_var('page');
        $max_num_pages = isset($post->post_content) ? substr_count($post->post_content, '<!--nextpage-->') : 1;
        if ($max_num_pages >= 1) {
            $max_num_pages++;
        }
    }
    // Let's do date first as it's a bit more work to get right.
    if ($r->post_date != '') {
        $date = mysql2date(get_option('date_format'), $r->post_date);
    } else {
        if (get_query_var('day') && get_query_var('day') != '') {
            $date = get_the_date();
        } else {
            if (single_month_title(' ', false) && single_month_title(' ', false) != '') {
                $date = single_month_title(' ', false);
            } else {
                if (get_query_var('year') != '') {
                    $date = get_query_var('year');
                } else {
                    $date = '';
                }
            }
        }
    }
    $replacements = array('%%date%%' => $date, '%%searchphrase%%' => esc_html(get_query_var('s')), '%%page%%' => $max_num_pages > 1 && $pagenum > 1 ? sprintf($sep . ' ' . __('Page %d of %d', 'wordpress-seo'), $pagenum, $max_num_pages) : '', '%%pagetotal%%' => $max_num_pages, '%%pagenumber%%' => $pagenum);
    if (isset($r->ID)) {
        $replacements = array_merge($replacements, array('%%caption%%' => $r->post_excerpt, '%%category%%' => wpseo_get_terms($r->ID, 'category'), '%%excerpt%%' => !empty($r->post_excerpt) ? strip_tags($r->post_excerpt) : utf8_encode(substr(strip_shortcodes(strip_tags(utf8_decode($r->post_content))), 0, 155)), '%%excerpt_only%%' => strip_tags($r->post_excerpt), '%%focuskw%%' => wpseo_get_value('focuskw', $r->ID), '%%id%%' => $r->ID, '%%modified%%' => mysql2date(get_option('date_format'), $r->post_modified), '%%name%%' => get_the_author_meta('display_name', !empty($r->post_author) ? $r->post_author : get_query_var('author')), '%%tag%%' => wpseo_get_terms($r->ID, 'post_tag'), '%%title%%' => stripslashes($r->post_title), '%%userid%%' => !empty($r->post_author) ? $r->post_author : get_query_var('author')));
    }
    if (!empty($r->taxonomy)) {
        $replacements = array_merge($replacements, array('%%category_description%%' => trim(strip_tags(get_term_field('description', $r->term_id, $r->taxonomy))), '%%tag_description%%' => trim(strip_tags(get_term_field('description', $r->term_id, $r->taxonomy))), '%%term_description%%' => trim(strip_tags(get_term_field('description', $r->term_id, $r->taxonomy))), '%%term_title%%' => $r->name));
    }
    foreach ($replacements as $var => $repl) {
        if (!in_array($var, $omit)) {
            $string = str_replace($var, $repl, $string);
        }
    }
    if (strpos($string, '%%') === false) {
        $string = preg_replace('/\\s+/u', ' ', $string);
        return trim($string);
    }
    if (isset($wp_query->query_vars['post_type']) && preg_match_all('/%%pt_([^%]+)%%/u', $string, $matches, PREG_SET_ORDER)) {
        $pt = get_post_type_object($wp_query->query_vars['post_type']);
        $pt_plural = $pt_singular = $pt->name;
        if (isset($pt->labels->singular_name)) {
            $pt_singular = $pt->labels->singular_name;
        }
        if (isset($pt->labels->name)) {
            $pt_plural = $pt->labels->name;
        }
        $string = str_replace('%%pt_single%%', $pt_singular, $string);
        $string = str_replace('%%pt_plural%%', $pt_plural, $string);
    }
    if (preg_match_all('/%%cf_([^%]+)%%/u', $string, $matches, PREG_SET_ORDER)) {
        global $post;
        foreach ($matches as $match) {
            $string = str_replace($match[0], get_post_meta($post->ID, $match[1], true), $string);
        }
    }
    if (preg_match_all('/%%ct_desc_([^%]+)?%%/u', $string, $matches, PREG_SET_ORDER)) {
        global $post;
        foreach ($matches as $match) {
            $terms = get_the_terms($post->ID, $match[1]);
            $string = str_replace($match[0], get_term_field('description', $terms[0]->term_id, $match[1]), $string);
        }
    }
    if (preg_match_all('/%%ct_([^%]+)%%(single%%)?/u', $string, $matches, PREG_SET_ORDER)) {
        foreach ($matches as $match) {
            $single = false;
            if (isset($match[2]) && $match[2] == 'single%%') {
                $single = true;
            }
            $ct_terms = wpseo_get_terms($r->ID, $match[1], $single);
            $string = str_replace($match[0], $ct_terms, $string);
        }
    }
    $string = preg_replace('/\\s+/u', ' ', $string);
    return trim($string);
}
Example #16
0
function breadcrumbs($args = array())
{
    $delimiter = __('<span class="crumbs-span">/</span>', 'vbegy');
    $home = __('Home', 'vbegy');
    $before = '<h1>';
    $after = '</h1>';
    if (!is_home() && !is_front_page() || is_paged()) {
        echo '<div class="breadcrumbs"><section class="container"><div class="row"><div class="col-md-12">';
        global $post, $wp_query;
        $item = array();
        $homeLink = home_url();
        if (is_search()) {
            echo $before . __("Search", "vbegy") . $after;
        } else {
            if (is_page()) {
                echo $before . get_the_title() . $after;
            } else {
                if (is_attachment()) {
                    $parent = get_post($post->post_parent);
                    $cat = get_the_category($parent->ID);
                    echo $before . get_the_title() . $after;
                } elseif (is_singular()) {
                    $post = $wp_query->get_queried_object();
                    $post_id = (int) $wp_query->get_queried_object_id();
                    $post_type = $post->post_type;
                    $post_type_object = get_post_type_object($post_type);
                    if ('post' === $wp_query->post->post_type || 'question' === $wp_query->post->post_type || 'product' === $wp_query->post->post_type) {
                        echo $before . get_the_title() . $after;
                    }
                    if ('page' !== $wp_query->post->post_type) {
                        if (isset($args["singular_{$wp_query->post->post_type}_taxonomy"]) && is_taxonomy_hierarchical($args["singular_{$wp_query->post->post_type}_taxonomy"])) {
                            $terms = wp_get_object_terms($post_id, $args["singular_{$wp_query->post->post_type}_taxonomy"]);
                            echo array_merge($item, breadcrumbs_plus_get_term_parents($terms[0], $args["singular_{$wp_query->post->post_type}_taxonomy"]));
                        } elseif (isset($args["singular_{$wp_query->post->post_type}_taxonomy"])) {
                            echo get_the_term_list($post_id, $args["singular_{$wp_query->post->post_type}_taxonomy"], '', ', ', '');
                        }
                    }
                } else {
                    if (is_category() || is_tag() || is_tax()) {
                        global $wp_query;
                        $term = $wp_query->get_queried_object();
                        $taxonomy = get_taxonomy($term->taxonomy);
                        if (is_taxonomy_hierarchical($term->taxonomy) && $term->parent && ($parents = breadcrumbs_plus_get_term_parents($term->parent, $term->taxonomy))) {
                            $item = array_merge($item, $parents);
                        }
                        //echo $term->name;
                        echo $before . '' . single_cat_title('', false) . '' . $after;
                    } elseif (is_day()) {
                        echo $before . __('Daily Archives : ', 'vbegy') . get_the_time('d') . $after;
                    } elseif (is_month()) {
                        echo $before . __('Monthly Archives : ', 'vbegy') . get_the_time('F') . $after;
                    } elseif (is_year()) {
                        echo $before . __('Yearly Archives : ', 'vbegy') . get_the_time('Y') . $after;
                    } elseif (is_single() && !is_attachment()) {
                        if (get_post_type() != 'post' && get_post_type() != 'question' && get_post_type() != 'product') {
                            $post_type = get_post_type_object(get_post_type());
                            $slug = $post_type->rewrite;
                            echo $before . get_the_title() . $after;
                        } else {
                            $cat = get_the_category();
                            $cat = $cat[0];
                            echo $before . get_the_title() . $after;
                        }
                    } elseif (!is_single() && !is_page() && get_post_type() != 'post' && get_post_type() != 'question' && get_post_type() != 'product') {
                        if (is_author()) {
                            global $author;
                            $userdata = get_userdata($author);
                            echo $before . $userdata->display_name . $after;
                        } else {
                            $post_type = get_post_type_object(get_post_type());
                            echo $before . (isset($post_type->labels->singular_name) ? $post_type->labels->singular_name : __("Error 404", "vbegy")) . $after;
                        }
                    } elseif (is_attachment()) {
                        $parent = get_post($post->post_parent);
                        $cat = get_the_category($parent->ID);
                        echo $before . get_the_title() . $after;
                    } elseif (is_page() && !$post->post_parent) {
                        echo $before . get_the_title() . $after;
                    } elseif (is_page() && $post->post_parent) {
                        $parent_id = $post->post_parent;
                        $breadcrumbs = array();
                        while ($parent_id) {
                            $page = get_page($parent_id);
                            $breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>';
                            $parent_id = $page->post_parent;
                        }
                        $breadcrumbs = array_reverse($breadcrumbs);
                        foreach ($breadcrumbs as $crumb) {
                            echo $crumb . ' ' . $delimiter . ' ';
                        }
                        echo $before . get_the_title() . $after;
                    } elseif (is_search()) {
                        echo $before . get_search_query() . $after;
                    } elseif (is_tag()) {
                        echo $before . single_tag_title('', false) . $after;
                    } elseif (is_author()) {
                        global $author;
                        $userdata = get_userdata($author);
                        echo $before . $userdata->display_name . $after;
                    } elseif (is_404()) {
                        echo $before . __('Error 404 ', 'vbegy') . $after;
                    } else {
                        if (is_archive()) {
                            if (is_category() || is_tag() || is_tax()) {
                                $term = $wp_query->get_queried_object();
                                $taxonomy = get_taxonomy($term->taxonomy);
                                if (is_taxonomy_hierarchical($term->taxonomy) && $term->parent && ($parents = breadcrumbs_plus_get_term_parents($term->parent, $term->taxonomy))) {
                                    $item = array_merge($item, $parents);
                                }
                                echo $before . $term->name . $after;
                            } else {
                                if (function_exists('is_post_type_archive') && is_post_type_archive()) {
                                    $post_type_object = get_post_type_object(get_query_var('post_type'));
                                    echo $before . $post_type_object->labels->name . $after;
                                } else {
                                    if (is_date()) {
                                        if (is_day()) {
                                            echo $before . __('Archives for ', 'theme') . get_the_time('F j, Y') . $after;
                                        } elseif (is_month()) {
                                            echo $before . __('Archives for ', 'theme') . single_month_title(' ', false) . $after;
                                        } elseif (is_year()) {
                                            echo $before . __('Archives for ', 'theme') . get_the_time('Y') . $after;
                                        }
                                    } else {
                                        if (is_author()) {
                                            echo $before . __('Archives by: ', 'theme') . get_the_author_meta('display_name', $wp_query->post->post_author) . $after;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        $before = '<span class="current">';
        $after = '</span>';
        echo '<div class="clearfix"></div>
        <div class="crumbs">
        <a itemprop="breadcrumb" href="' . $homeLink . '">' . $home . '</a>' . $delimiter . ' ';
        if (is_search()) {
            echo $before . __("Search", "vbegy") . $after;
        } else {
            if (is_category() || is_tag() || is_tax()) {
                global $wp_query;
                $term = $wp_query->get_queried_object();
                $taxonomy = get_taxonomy($term->taxonomy);
                if (is_taxonomy_hierarchical($term->taxonomy) && $term->parent && ($parents = breadcrumbs_plus_get_term_parents($term->parent, $term->taxonomy))) {
                    $item = array_merge($item, $parents);
                }
                //echo $term->name;
                echo $before . '' . single_cat_title('', false) . '' . $after;
            } elseif (is_day()) {
                echo '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a>' . $delimiter . '';
                echo '<a href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '">' . get_the_time('F') . '</a>' . $delimiter . '';
                echo $before . get_the_time('d') . $after;
            } elseif (is_month()) {
                echo '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a>' . $delimiter . '';
                echo $before . get_the_time('F') . $after;
            } elseif (is_year()) {
                echo $before . get_the_time('Y') . $after;
            } elseif (is_single() && !is_attachment()) {
                if (get_post_type() != 'post') {
                    $post_type = get_post_type_object(get_post_type());
                    $slug = $post_type->rewrite;
                    if (get_post_type() == 'question') {
                        $question_category = wp_get_post_terms($post->ID, 'question-category', array("fields" => "all"));
                        if (isset($question_category[0])) {
                            ?>
                        <a href="<?php 
                            echo get_term_link($question_category[0]->slug, "question-category");
                            ?>
"><?php 
                            echo $question_category[0]->name;
                            ?>
</a>
                    <?php 
                        }
                        echo $delimiter;
                    } else {
                        if (get_post_type() == 'product') {
                            global $product;
                            echo $product->get_categories(', ', '');
                            echo $delimiter;
                        } else {
                            echo '<a href="' . $homeLink . '/' . $slug['slug'] . '/">' . $post_type->labels->singular_name . '</a>' . $delimiter . '';
                        }
                    }
                    echo "" . $before . get_the_title() . $after;
                } else {
                    $cat = get_the_category();
                    $cat = $cat[0];
                    echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');
                    echo $before . get_the_title() . $after;
                }
            } elseif (!is_single() && !is_page() && get_post_type() != 'post') {
                if (is_author()) {
                    global $author;
                    $userdata = get_userdata($author);
                    echo $before . $userdata->display_name . $after;
                } else {
                    $post_type = get_post_type_object(get_post_type());
                    echo $before . (isset($post_type->labels->singular_name) ? $post_type->labels->singular_name : __("Error 404", "vbegy")) . $after;
                }
            } elseif (is_attachment()) {
                $parent = get_post($post->post_parent);
                $cat = get_the_category($parent->ID);
                echo '<a href="' . get_permalink($parent) . '">' . $parent->post_title . '</a>' . $delimiter . '';
                echo $before . get_the_title() . $after;
            } elseif (is_page() && !$post->post_parent) {
                echo $before . get_the_title() . $after;
            } elseif (is_page() && $post->post_parent) {
                $parent_id = $post->post_parent;
                $breadcrumbs = array();
                while ($parent_id) {
                    $page = get_page($parent_id);
                    $breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>';
                    $parent_id = $page->post_parent;
                }
                $breadcrumbs = array_reverse($breadcrumbs);
                foreach ($breadcrumbs as $crumb) {
                    echo $crumb . ' ' . $delimiter . ' ';
                }
                echo $before . get_the_title() . $after;
            } elseif (is_search()) {
                echo $before . __('Search results for ', 'vbegy') . '"' . get_search_query() . '"' . $after;
            } elseif (is_tag()) {
                echo $before . __('Posts tagged ', 'vbegy') . '"' . single_tag_title('', false) . '"' . $after;
            } elseif (is_author()) {
                global $author;
                $userdata = get_userdata($author);
                echo $before . $userdata->display_name . $after;
            } elseif (is_404()) {
                echo $before . __('Error 404 ', 'vbegy') . $after;
            }
        }
        if (get_query_var('paged')) {
            if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author()) {
                echo ' (';
            }
            echo "<span class='crumbs-span'>/</span><span class='current'>" . __('Page', 'vbegy') . ' ' . get_query_var('paged') . "</span>";
            if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author()) {
                echo ')';
            }
        }
        echo '</div></div></div></section></div>';
    }
}
Example #17
0
        <div id="container">

            <h1><?php 
if (is_category() || is_tax()) {
    _e('Category archive: ', LANGUAGE_ZONE);
    echo single_cat_title(null, false);
} elseif (is_tag()) {
    _e('Tag archive: ', LANGUAGE_ZONE);
    echo single_tag_title(null, false);
} elseif (is_author()) {
    $curauth = get_query_var('author_name') ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
    _e('Author archive: ', LANGUAGE_ZONE);
    echo $curauth->nickname;
} elseif (is_date()) {
    _e('Date archive: ', LANGUAGE_ZONE);
    echo single_month_title(' ', false);
} else {
    global $post;
    _e('Archive: ', LANGUAGE_ZONE);
    if ($post) {
        echo get_post_format_string(get_post_format());
    } else {
        echo 'Standard';
    }
}
?>
</h1>

            <div class="hr hr-wide gap-big"></div>
			<!-- archive -->
            <?php 
Example #18
0
 /**
  * Main title function.
  *
  * @param string $title       Title that might have already been set.
  * @param string $sepinput    Separator determined in theme.
  * @param string $seplocation Whether the separator should be left or right.
  *
  * @return string
  */
 function title($title, $sepinput = '-', $seplocation = '')
 {
     global $sep;
     $sep = $sepinput;
     if (is_feed()) {
         return $title;
     }
     // This needs to be kept track of in order to generate
     // default titles for singular pages.
     $original_title = $title;
     // This conditional ensures that sites that use of wp_title(''); as the plugin
     // used to suggest will still work properly with these changes.
     if ('' === trim($sep) && '' === $seplocation) {
         $sep = '-';
         $seplocation = 'right';
     } elseif ('' === $seplocation) {
         $seplocation = is_rtl() ? 'left' : 'right';
     }
     $sep = ' ' . trim($sep) . ' ';
     // This flag is used to determine if any additional
     // processing should be done to the title after the
     // main section of title generation completes.
     $modified_title = true;
     // This variable holds the page-specific title part
     // that is used to generate default titles.
     $title_part = '';
     if ($this->is_home_static_page()) {
         $title = $this->get_content_title();
     } elseif ($this->is_home_posts_page()) {
         $title = $this->get_title_from_options('title-home-wpseo');
     } elseif ($this->is_posts_page()) {
         $title = $this->get_content_title(get_post(get_option('page_for_posts')));
     } elseif (is_singular()) {
         $title = $this->get_content_title();
         if (!is_string($title) || '' === $title) {
             $title_part = $original_title;
         }
     } elseif (is_search()) {
         $title = $this->get_title_from_options('title-search-wpseo');
         if (!is_string($title) || '' === $title) {
             $title_part = sprintf(__('Search for "%s"', 'wordpress-seo'), esc_html(get_search_query()));
         }
     } elseif (is_category() || is_tag() || is_tax()) {
         $title = $this->get_taxonomy_title();
         if (!is_string($title) || '' === $title) {
             if (is_category()) {
                 $title_part = single_cat_title('', false);
             } elseif (is_tag()) {
                 $title_part = single_tag_title('', false);
             } else {
                 $title_part = single_term_title('', false);
                 if ($title_part === '') {
                     global $wp_query;
                     $term = $wp_query->get_queried_object();
                     $title_part = $term->name;
                 }
             }
         }
     } elseif (is_author()) {
         $title = $this->get_author_title();
         if (!is_string($title) || '' === $title) {
             $title_part = get_the_author_meta('display_name', get_query_var('author'));
         }
     } elseif (is_post_type_archive()) {
         $post_type = get_query_var('post_type');
         if (is_array($post_type)) {
             $post_type = reset($post_type);
         }
         $title = $this->get_title_from_options('title-ptarchive-' . $post_type);
         if (!is_string($title) || '' === $title) {
             $post_type_obj = get_post_type_object($post_type);
             if (isset($post_type_obj->labels->menu_name)) {
                 $title_part = $post_type_obj->labels->menu_name;
             } elseif (isset($post_type_obj->name)) {
                 $title_part = $post_type_obj->name;
             } else {
                 $title_part = '';
                 //To be determined what this should be
             }
         }
     } elseif (is_archive()) {
         $title = $this->get_title_from_options('title-archive-wpseo');
         // @todo [JRF => Yoast] Should these not use the archive default if no title found ?
         // WPSEO_Options::get_default( 'wpseo_titles', 'title-archive-wpseo' )
         // Replacement would be needed!
         if (empty($title)) {
             if (is_month()) {
                 $title_part = sprintf(__('%s Archives', 'wordpress-seo'), single_month_title(' ', false));
             } elseif (is_year()) {
                 $title_part = sprintf(__('%s Archives', 'wordpress-seo'), get_query_var('year'));
             } elseif (is_day()) {
                 $title_part = sprintf(__('%s Archives', 'wordpress-seo'), get_the_date());
             } else {
                 $title_part = __('Archives', 'wordpress-seo');
             }
         }
     } elseif (is_404()) {
         if (0 !== get_query_var('year') || (0 !== get_query_var('monthnum') || 0 !== get_query_var('day'))) {
             // @todo [JRF => Yoast] Should these not use the archive default if no title found ?
             if (0 !== get_query_var('day')) {
                 $date = sprintf('%04d-%02d-%02d 00:00:00', get_query_var('year'), get_query_var('monthnum'), get_query_var('day'));
                 $date = mysql2date(get_option('date_format'), $date, true);
                 $date = apply_filters('get_the_date', $date, '');
                 $title_part = sprintf(__('%s Archives', 'wordpress-seo'), $date);
             } elseif (0 !== get_query_var('monthnum')) {
                 $title_part = sprintf(__('%s Archives', 'wordpress-seo'), single_month_title(' ', false));
             } elseif (0 !== get_query_var('year')) {
                 $title_part = sprintf(__('%s Archives', 'wordpress-seo'), get_query_var('year'));
             } else {
                 $title_part = __('Archives', 'wordpress-seo');
             }
         } else {
             $title = $this->get_title_from_options('title-404-wpseo');
             // @todo [JRF => Yoast] Should these not use the 404 default if no title found ?
             // WPSEO_Options::get_default( 'wpseo_titles', 'title-404-wpseo' )
             // Replacement would be needed!
             if (empty($title)) {
                 $title_part = __('Page not found', 'wordpress-seo');
             }
         }
     } else {
         // In case the page type is unknown, leave the title alone.
         $modified_title = false;
         // If you would like to generate a default title instead,
         // the following code could be used instead of the line above:
         // $title_part = $title;
     }
     if ($modified_title && empty($title) || !empty($title_part)) {
         $title = $this->get_default_title($sep, $seplocation, $title_part);
     }
     if (defined('ICL_LANGUAGE_CODE') && false !== strpos($title, ICL_LANGUAGE_CODE)) {
         $title = str_replace(' @' . ICL_LANGUAGE_CODE, '', $title);
     }
     /**
      * Filter: 'wpseo_title' - Allow changing the WP SEO <title> output
      *
      * @api string $title The page title being put out.
      */
     return esc_html(strip_tags(stripslashes(apply_filters('wpseo_title', $title))));
 }
Example #19
0
    ?>
</span></h1><hr class="page-title-hr">
			<?php 
} elseif (is_category()) {
    ?>
			
				<h1 class="page-title"><span><?php 
    single_cat_title();
    ?>
</span></h1><hr class="page-title-hr">
			<?php 
} elseif (is_archive()) {
    ?>
			
				<h1 class="page-title"><span><?php 
    single_month_title();
    ?>
</span></h1><hr class="page-title-hr">
			<?php 
} elseif (is_author()) {
    ?>
			
				<h1 class="page-title"><span><?php 
    the_author();
    ?>
</span></h1><hr class="page-title-hr">			
			<?php 
} elseif (is_search()) {
    ?>
		
				<h1 class="page-title"><span><?php 
Example #20
0
/**
 * Function for handling what the browser/search engine title should be. Attempts to handle every 
 * possible situation WordPress throws at it for the best optimization.
 *
 * @since 0.1.0
 * @global $wp_query
 */
function hybrid_document_title() {
	global $wp_query;

	/* Set up some default variables. */
	$domain = hybrid_get_textdomain();
	$doctitle = '';
	$separator = ':';

	/* If viewing the front page and posts page of the site. */
	if ( is_front_page() && is_home() )
		$doctitle = get_bloginfo( 'name' ) . $separator . ' ' . get_bloginfo( 'description' );

	/* If viewing the posts page or a singular post. */
	elseif ( is_home() || is_singular() ) {
		$post_id = $wp_query->get_queried_object_id();

		$doctitle = get_post_meta( $post_id, 'Title', true );

		if ( empty( $doctitle ) && is_front_page() )
			$doctitle = get_bloginfo( 'name' ) . $separator . ' ' . get_bloginfo( 'description' );

		elseif ( empty( $doctitle ) )
			$doctitle = get_post_field( 'post_title', $post_id );
	}

	/* If viewing any type of archive page. */
	elseif ( is_archive() ) {

		/* If viewing a taxonomy term archive. */
		if ( is_category() || is_tag() || is_tax() ) {

			if ( function_exists( 'single_term_title' ) ) {
				$doctitle = single_term_title( '', false );
			} else { // 3.0 compat
				$term = $wp_query->get_queried_object();
				$doctitle = $term->name;
			}
		}

		/* If viewing a post type archive. */
		elseif ( function_exists( 'is_post_type_archive' ) && is_post_type_archive() ) {
			$post_type = get_post_type_object( get_query_var( 'post_type' ) );
			$doctitle = $post_type->labels->name;
		}

		/* If viewing an author/user archive. */
		elseif ( is_author() )
			$doctitle = get_the_author_meta( 'display_name', get_query_var( 'author' ) );

		/* If viewing a date-/time-based archive. */
		elseif ( is_date () ) {
			if ( get_query_var( 'minute' ) && get_query_var( 'hour' ) )
				$doctitle = sprintf( __( 'Archive for %1$s', $domain ), get_the_time( __( 'g:i a', $domain ) ) );

			elseif ( get_query_var( 'minute' ) )
				$doctitle = sprintf( __( 'Archive for minute %1$s', $domain ), get_the_time( __( 'i', $domain ) ) );

			elseif ( get_query_var( 'hour' ) )
				$doctitle = sprintf( __( 'Archive for %1$s', $domain ), get_the_time( __( 'g a', $domain ) ) );

			elseif ( is_day() )
				$doctitle = sprintf( __( 'Archive for %1$s', $domain ), get_the_time( __( 'F jS, Y', $domain ) ) );

			elseif ( get_query_var( 'w' ) )
				$doctitle = sprintf( __( 'Archive for week %1$s of %2$s', $domain ), get_the_time( __( 'W', $domain ) ), get_the_time( __( 'Y', $domain ) ) );

			elseif ( is_month() )
				$doctitle = sprintf( __( 'Archive for %1$s', $domain ), single_month_title( ' ', false) );

			elseif ( is_year() )
				$doctitle = sprintf( __( 'Archive for %1$s', $domain ), get_the_time( __( 'Y', $domain ) ) );
		}
	}

	/* If viewing a search results page. */
	elseif ( is_search() )
		$doctitle = sprintf( __( 'Search results for &quot;%1$s&quot;', $domain ), esc_attr( get_search_query() ) );

	/* If viewing a 404 not found page. */
	elseif ( is_404() )
		$doctitle = __( '404 Not Found', $domain );

	/* If the current page is a paged page. */
	if ( ( ( $page = $wp_query->get( 'paged' ) ) || ( $page = $wp_query->get( 'page' ) ) ) && $page > 1 )
		$doctitle = sprintf( __( '%1$s Page %2$s', $domain ), $doctitle . $separator, number_format_i18n( $page ) );

	/* Apply the wp_title filters so we're compatible with plugins. */
	$doctitle = apply_filters( 'wp_title', $doctitle, $separator, '' );

	/* Print the title to the screen. */
	echo apply_atomic( 'document_title', esc_attr( $doctitle ) );
}
Example #21
0
function tokopress_default_title($title, $sep = '', $seplocation = '')
{
    if (is_home()) {
        $title = get_bloginfo('name');
    }
    global $wp_query;
    $doctitle = '';
    if (is_404()) {
        $doctitle = __('404 - Not Found', 'tokopress');
    } elseif (is_search()) {
        $doctitle = sprintf(__('Search Results for "%1$s"', 'tokopress'), esc_attr(get_search_query()));
    } elseif (is_home() || is_front_page()) {
        $doctitle = get_bloginfo('name') . ' | ' . get_bloginfo('description');
    } elseif (is_author()) {
        $doctitle = get_the_author_meta('display_name', get_query_var('author'));
    } elseif (is_date()) {
        if (get_query_var('minute') && get_query_var('hour')) {
            $doctitle = sprintf(__('Archive for %1$s', 'tokopress'), get_the_time(__('g:i a', 'tokopress')));
        } elseif (get_query_var('minute')) {
            $doctitle = sprintf(__('Archive for minute %1$s', 'tokopress'), get_the_time(__('i', 'tokopress')));
        } elseif (get_query_var('hour')) {
            $doctitle = sprintf(__('Archive for %1$s', 'tokopress'), get_the_time(__('g a', 'tokopress')));
        } elseif (is_day()) {
            $doctitle = sprintf(__('Archive for %1$s', 'tokopress'), get_the_time(__('F jS, Y', 'tokopress')));
        } elseif (get_query_var('w')) {
            $doctitle = sprintf(__('Archive for week %1$s of %2$s', 'tokopress'), get_the_time(__('W', 'tokopress')), get_the_time(__('Y', 'tokopress')));
        } elseif (is_month()) {
            $doctitle = sprintf(__('Archive for %1$s', 'tokopress'), single_month_title(' ', false));
        } elseif (is_year()) {
            $doctitle = sprintf(__('Archive for %1$s', 'tokopress'), get_the_time(__('Y', 'tokopress')));
        }
    } elseif (class_exists('woocommerce') && is_shop()) {
        $doctitle = __('Shop', 'tokopress');
    } elseif (function_exists('is_post_type_archive') && is_post_type_archive()) {
        $post_type = get_post_type_object(get_query_var('post_type'));
        $doctitle = $post_type->labels->name;
    } elseif (is_category() || is_tag() || is_tax()) {
        $term = $wp_query->get_queried_object();
        $doctitle = $term->name;
    } elseif (is_singular()) {
        $post_id = $wp_query->get_queried_object_id();
        $doctitle = get_post_field('post_title', $post_id);
    }
    if (get_query_var('paged')) {
        $doctitle .= ' ' . sprintf(__('- Page %s', 'tokopress'), get_query_var('paged'));
    }
    $doctitle = esc_attr($doctitle);
    if ($doctitle) {
        return $doctitle;
    } else {
        return $title;
    }
}
Example #22
0
 /**
  * Return the month archive crumb.
  *
  * @since 1.9.0
  *
  * @return string HTML markup
  */
 protected function get_month_crumb()
 {
     $year = get_query_var('m') ? mb_substr(get_query_var('m'), 0, 4) : get_query_var('year');
     $crumb = $this->get_breadcrumb_link(get_year_link($year), '', $year, $this->args['sep']);
     $crumb .= $this->args['labels']['date'] . single_month_title(' ', false);
     /**
      * Filter the month archive breadcrumb.
      *
      * @since 1.9.0
      *
      * @param string $crumb HTML markup for the month archive breadcrumb.
      * @param array  $args  Arguments used to generate the breadcrumbs. Documented in Genesis_Breadcrumbs::get_output().
      */
     return apply_filters('genesis_month_crumb', $crumb, $this->args);
 }
Example #23
0
/**
 * Gets the loop description.  This function should only be used on archive-type pages, such as archive, blog, and 
 * search results pages.  It outputs the description of the page.
 *
 * @link   http://core.trac.wordpress.org/ticket/21995
 * @since  2.0.0
 * @access public
 * @return string
 */
function hybrid_get_loop_description()
{
    $loop_desc = '';
    if (is_home() && !is_front_page()) {
        $loop_desc = get_post_field('post_content', get_queried_object_id(), 'raw');
    } elseif (is_category()) {
        $loop_desc = get_term_field('description', get_queried_object_id(), 'category', 'raw');
    } elseif (is_tag()) {
        $loop_desc = get_term_field('description', get_queried_object_id(), 'post_tag', 'raw');
    } elseif (is_tax()) {
        $loop_desc = get_term_field('description', get_queried_object_id(), get_query_var('taxonomy'), 'raw');
    } elseif (is_author()) {
        $loop_desc = get_the_author_meta('description', get_query_var('author'));
    } elseif (is_search()) {
        $loop_desc = sprintf(__('You are browsing the search results for &#8220;%s&#8221;', 'hybrid-core'), get_search_query());
    } elseif (is_post_type_archive()) {
        $loop_desc = get_post_type_object(get_query_var('post_type'))->description;
    } elseif (is_time()) {
        $loop_desc = __('You are browsing the site archives by time.', 'hybrid-core');
    } elseif (is_day()) {
        $loop_desc = sprintf(__('You are browsing the site archives for %s.', 'hybrid-core'), hybrid_single_day_title('', false));
    } elseif (is_month()) {
        $loop_desc = sprintf(__('You are browsing the site archives for %s.', 'hybrid-core'), single_month_title(' ', false));
    } elseif (is_year()) {
        $loop_desc = sprintf(__('You are browsing the site archives for %s.', 'hybrid-core'), hybrid_single_year_title('', false));
    } elseif (is_archive()) {
        $loop_desc = __('You are browsing the site archives.', 'hybrid-core');
    }
    return apply_filters('hybrid_loop_description', $loop_desc);
}
" />
	<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php 
bloginfo('atom_url');
?>
" />
	<link rel="pingback" href="<?php 
bloginfo('pingback_url');
?>
" />
    <link rel="EditURI" type="application/rsd+xml" title="RSD" href="<?php 
echo $siteurl;
?>
/wp-rsd.php" />
    <?php 
get_archives('monthly', '', 'link');
?>
	<?php 
// comments_popup_script(); // off by default
$my_header = ob_get_contents();
ob_end_clean();
//include(XOOPS_ROOT_PATH.'/header.php');
ob_start();
echo bloginfo('name');
$blog_name = ob_get_contents();
ob_end_clean();
$module_title = $blog_name . " &raquo;" . single_post_title(' :: ', false) . single_cat_title(' :: ', false) . single_month_title(' :: ', false);
global $xoopsTpl;
if ($xoopsTpl) {
    $xoopsTpl->assign("xoops_pagetitle", $module_title);
    $xoopsTpl->assign('xoops_module_header', $my_header);
}
bloginfo('atom_url');
?>
" />
	<link rel="pingback" href="<?php 
bloginfo('pingback_url');
?>
" />
	<link rel="EditURI" type="application/rsd+xml" title="RSD" href="<?php 
echo $siteurl;
?>
/wp-rsd.php" />
<?php 
get_archives('monthly', '', 'link');
// comments_popup_script(); // off by default
$my_header = ob_get_contents();
ob_end_clean();
ob_start();
echo bloginfo('name');
$blog_name = ob_get_contents();
ob_end_clean();
$module_title = single_post_title(' :: ', false) . single_cat_title(' :: ', false) . single_month_title(' :: ', false);
if (trim($module_title) == "") {
    $module_title = $blog_name;
} else {
    $module_title = $blog_name . " : " . $module_title;
}
global $xoopsTpl;
if ($xoopsTpl) {
    $xoopsTpl->assign("xoops_pagetitle", $module_title);
    $xoopsTpl->assign('xoops_module_header', $my_header);
}
Example #26
0
 /**
  * Main title function.
  *
  * @param string $title       Title that might have already been set.
  * @param string $sepinput    Separator determined in theme.
  * @param string $seplocation Whether the separator should be left or right.
  * @return string
  */
 function title($title, $sepinput = '-', $seplocation = '')
 {
     global $sep;
     $sep = $sepinput;
     if (is_feed()) {
         return $title;
     }
     // This needs to be kept track of in order to generate
     // default titles for singular pages.
     $original_title = $title;
     // This conditional ensures that sites that use of wp_title(''); as the plugin
     // used to suggest will still work properly with these changes.
     if ('' == trim($sep) && '' == $seplocation) {
         $sep = '-';
         $seplocation = 'right';
     } else {
         if ('' == $seplocation) {
             $seplocation = is_rtl() ? 'left' : 'right';
         }
     }
     $sep = ' ' . trim($sep) . ' ';
     // This flag is used to determine if any additional
     // processing should be done to the title after the
     // main section of title generation completes.
     $modified_title = true;
     // This variable holds the page-specific title part
     // that is used to generate default titles.
     $title_part = '';
     if ($this->is_home_static_page()) {
         $title = $this->get_content_title();
     } else {
         if ($this->is_home_posts_page()) {
             $title = $this->get_title_from_options('title-home');
         } else {
             if ($this->is_posts_page()) {
                 $title = $this->get_content_title(get_post(get_option('page_for_posts')));
             } else {
                 if (is_singular()) {
                     $title = $this->get_content_title();
                     if (empty($title)) {
                         $title_part = $original_title;
                     }
                 } else {
                     if (is_search()) {
                         $title = $this->get_title_from_options('title-search');
                         if (empty($title)) {
                             $title_part = sprintf(__('Search for "%s"', 'wordpress-seo'), get_search_query());
                         }
                     } else {
                         if (is_category() || is_tag() || is_tax()) {
                             $title = $this->get_taxonomy_title();
                             if (empty($title)) {
                                 if (is_category()) {
                                     $title_part = single_cat_title('', false);
                                 } else {
                                     if (is_tag()) {
                                         $title_part = single_tag_title('', false);
                                     } else {
                                         if (function_exists('single_term_title')) {
                                             $title_part = single_term_title('', false);
                                         } else {
                                             global $wp_query;
                                             $term = $wp_query->get_queried_object();
                                             $title_part = $term->name;
                                         }
                                     }
                                 }
                             }
                         } else {
                             if (is_author()) {
                                 $title = $this->get_author_title();
                                 if (empty($title)) {
                                     $title_part = get_the_author_meta('display_name', get_query_var('author'));
                                 }
                             } else {
                                 if (function_exists('is_post_type_archive') && is_post_type_archive()) {
                                     $post_type = get_post_type();
                                     $title = $this->get_title_from_options('title-ptarchive-' . $post_type);
                                     if (empty($title)) {
                                         $post_type_obj = get_post_type_object($post_type);
                                         if (isset($post_type_obj->labels->menu_name)) {
                                             $title_part = $post_type_obj->labels->menu_name;
                                         } else {
                                             $title_part = $post_type_obj->name;
                                         }
                                     }
                                 } else {
                                     if (is_archive()) {
                                         $title = $this->get_title_from_options('title-archive');
                                         if (empty($title)) {
                                             if (is_month()) {
                                                 $title_part = sprintf(__('%s Archives', 'wordpress-seo'), single_month_title(' ', false));
                                             } else {
                                                 if (is_year()) {
                                                     $title_part = sprintf(__('%s Archives', 'wordpress-seo'), get_query_var('year'));
                                                 } else {
                                                     if (is_day()) {
                                                         $title_part = sprintf(__('%s Archives', 'wordpress-seo'), get_the_date());
                                                     } else {
                                                         $title_part = __('Archives', 'wordpress-seo');
                                                     }
                                                 }
                                             }
                                         }
                                     } else {
                                         if (is_404()) {
                                             $title = $this->get_title_from_options('title-404');
                                             if (empty($title)) {
                                                 $title_part = __('Page not found', 'wordpress-seo');
                                             }
                                         } else {
                                             // In case the page type is unknown, leave the title alone.
                                             $modified_title = false;
                                             // If you would like to generate a default title instead,
                                             // the following code could be used instead of the line above:
                                             // $title_part = $title;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if ($modified_title && empty($title) || !empty($title_part)) {
         $title = $this->get_default_title($sep, $seplocation, $title_part);
     }
     return esc_html(strip_tags(stripslashes(apply_filters('wpseo_title', $title))));
 }
<div class="group uc-content-block">
	<?php 
if (is_archive()) {
    $target = '';
    if (is_author()) {
        $target = get_the_author();
    }
    if (is_date()) {
        $target = single_month_title(' ', false);
    }
    if (is_category()) {
        $target = single_cat_title(null, false);
    }
    if (is_tag()) {
        $target = single_tag_title(null, false);
    }
    if (strlen($target) > 0) {
        ?>
<h1 class="post-title"><?php 
        printf(__('All articles for %s', 'ubuntu-community'), $target);
        ?>
</h1><?php 
    } else {
        ?>
<h1 class="post-title"><?php 
        _e('Archive', 'ubuntu-community');
        ?>
</h1><?php 
    }
}
if (is_search() || strlen($_GET['s']) > 0) {
Example #28
0
<?php

if (!current_user_can('edit_posts') && is_post_type_archive(array('quiz', 'question', 'assignment', 'unit'))) {
    wp_die(__('Permission denied', 'vibe'));
}
get_header();
?>
<section id="title">
	<div class="container">
		<div class="row">
            <div class="col-md-9 col-sm8">
                <div class="pagetitle">
                    <h1><?php 
if (is_month()) {
    single_month_title(' ');
} elseif (is_year()) {
    echo get_the_time('Y');
} else {
    if (is_category()) {
        echo single_cat_title();
    } else {
        if (is_tag()) {
            single_tag_title();
        } else {
            post_type_archive_title();
        }
    }
}
?>
</h1>
                    <h5><?php 
Example #29
0
 /**
  *
  */
 function miss_document_title()
 {
     global $page, $paged, $wp_query;
     /* Set up some default variables. */
     $domain = MISS_TEXTDOMAIN;
     $doctitle = get_bloginfo('name');
     $separator = ' | ';
     $description = get_bloginfo('description', 'display');
     //$doctitle = get_bloginfo( 'name' );
     /* If viewing the front page and posts page of the site. */
     if (is_front_page() && is_home() && !is_singular()) {
         if ($description != "") {
             $doctitle = $description;
         } else {
             $separator = '';
         }
     }
     /* If viewing the posts page or a singular post. */
     if (is_home() || is_singular()) {
         $post_id = $wp_query->get_queried_object_id();
         $prefix = get_post_meta($post_id, 'Title', true);
         if (empty($prefix) && is_front_page()) {
             $prefix = get_bloginfo('name');
         } elseif (empty($prefix)) {
             $prefix = get_post_field('post_title', $post_id);
         }
     } elseif (is_archive()) {
         /* If viewing a taxonomy term archive. */
         if (is_category() || is_tag() || is_tax()) {
             $term = $wp_query->get_queried_object();
             $prefix = $term->name;
         } elseif (function_exists('is_post_type_archive') && is_post_type_archive()) {
             $post_type = get_post_type_object(get_query_var('post_type'));
             $prefix = miss_get_setting(get_post_type() . '_page_caption') ? miss_get_setting(get_post_type() . '_page_caption') : $post_type->labels->name;
         } elseif (is_author()) {
             $prefix = get_the_author_meta('display_name', get_query_var('author'));
         } elseif (is_date()) {
             if (get_query_var('minute') && get_query_var('hour')) {
                 $prefix = sprintf(__('Archive for %1$s', MISS_TEXTDOMAIN), get_the_time(__('g:i a', MISS_TEXTDOMAIN)));
             } elseif (get_query_var('minute')) {
                 $prefix = sprintf(__('Archive for minute %1$s', MISS_TEXTDOMAIN), get_the_time(__('i', MISS_TEXTDOMAIN)));
             } elseif (get_query_var('hour')) {
                 $prefix = sprintf(__('Archive for %1$s', MISS_TEXTDOMAIN), get_the_time(__('g a', MISS_TEXTDOMAIN)));
             } elseif (is_day()) {
                 $prefix = sprintf(__('Archive for %1$s', MISS_TEXTDOMAIN), get_the_time(__('F jS, Y', MISS_TEXTDOMAIN)));
             } elseif (get_query_var('w')) {
                 $prefix = sprintf(__('Archive for week %1$s of %2$s', MISS_TEXTDOMAIN), get_the_time(__('W', MISS_TEXTDOMAIN)), get_the_time(__('Y', MISS_TEXTDOMAIN)));
             } elseif (is_month()) {
                 $prefix = sprintf(__('Archive for %1$s', MISS_TEXTDOMAIN), single_month_title(' ', false));
             } elseif (is_year()) {
                 $prefix = sprintf(__('Archive for %1$s', MISS_TEXTDOMAIN), get_the_time(__('Y', MISS_TEXTDOMAIN)));
             }
         }
     } elseif (is_search()) {
         $prefix = sprintf(__('Search results for &quot;%1$s&quot;', MISS_TEXTDOMAIN), esc_attr(get_search_query()));
     } elseif (is_404()) {
         $prefix = __('404 Not Found', MISS_TEXTDOMAIN);
     } elseif (function_exists('bp_is_activity_component') && bp_is_activity_component()) {
         $prefix = __('Activity', MISS_TEXTDOMAIN);
     } elseif (function_exists('bp_is_group') && bp_is_group()) {
         $prefix = __('Group', MISS_TEXTDOMAIN);
     }
     /**
      * Events Calendar PRO Support
      * 
      * @since 1.8
      */
     if (class_exists('TribeEventsPro')) {
         if (function_exists('tribe_is_month') && tribe_is_month()) {
             $prefix = __('Events for', MISS_TEXTDOMAIN);
             $prefix .= Date("F Y", strtotime($wp_query->get('start_date')));
         }
         if (function_exists('tribe_is_day') && tribe_is_day()) {
             $prefix = __('Events for', MISS_TEXTDOMAIN);
             $prefix .= 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')) {
                 $prefix = 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 = Date("l, F jS Y", strtotime($wp_query->get('start_date') ) );
         }
         if (function_exists('tribe_is_map') && tribe_is_map() || function_exists('tribe_is_photo') && tribe_is_photo()) {
             if (tribe_is_past()) {
                 $prefix = __('Past Events', MISS_TEXTDOMAIN);
             } else {
                 $prefix = __('Upcoming Events', MISS_TEXTDOMAIN);
             }
         }
         if (function_exists('tribe_is_showing_all') && tribe_is_showing_all()) {
             $prefix = sprintf('%s %s', __('All events for', MISS_TEXTDOMAIN), get_the_title());
         }
     }
     /* If the current page is a paged page. */
     if ((($page = $wp_query->get('paged')) || ($page = $wp_query->get('page'))) && $page > 1) {
         $prefix = sprintf(__('%1$sPage %2$s', MISS_TEXTDOMAIN), $prefix . $separator, number_format_i18n($page));
     }
     if (is_front_page()) {
         $doctitle = $doctitle . $separator . $description;
     } else {
         $doctitle = $prefix . $separator . $doctitle;
     }
     /* Apply the wp_title filters so we're compatible with plugins. */
     $doctitle = apply_filters('wp_title', $doctitle, '', '');
     /* Return the title to the screen. */
     return apply_atomic('document_title', esc_attr($doctitle));
 }
Example #30
0
 function title($title, $sep = '-', $seplocation = '', $postid = '')
 {
     if (trim($sep) == '') {
         $sep = '-';
     }
     $sep = ' ' . $sep . ' ';
     global $wp_query;
     if (is_feed()) {
         return $title;
     }
     $options = get_wpseo_options();
     if (is_front_page() && 'posts' != get_option('show_on_front')) {
         global $post;
         $title = wpseo_get_value('title', $post->ID);
         if ('' == $title) {
             $title = $post->post_title . $sep . get_bloginfo('name');
         }
     } else {
         if (is_home() && 'posts' == get_option('show_on_front')) {
             if (isset($options['title-home']) && $options['title-home'] != '') {
                 $title = wpseo_replace_vars($options['title-home'], array());
             } else {
                 $title = get_bloginfo('name');
                 if ($wp_query->query_vars['paged']) {
                     $title .= $sep . $wp_query->query_vars['paged'] . '/' . $wp_query->max_num_pages;
                 }
                 $title .= $sep . get_bloginfo('description');
             }
         } else {
             if (is_home() && 'posts' != get_option('show_on_front')) {
                 $blogpage = get_post(get_option('page_for_posts'));
                 $fixed_title = wpseo_get_value('title', $blogpage->ID);
                 if ($fixed_title) {
                     $title = wpseo_replace_vars($fixed_title, (array) $blogpage);
                 } else {
                     if (isset($options['title-' . $blogpage->post_type]) && !empty($options['title-' . $blogpage->post_type])) {
                         $title = wpseo_replace_vars($options['title-' . $blogpage->post_type], (array) $blogpage);
                     } else {
                         $title = get_bloginfo('name');
                         if ($wp_query->query_vars['paged']) {
                             $title .= $sep . $wp_query->query_vars['paged'] . '/' . $wp_query->max_num_pages;
                         }
                         $title .= $sep . get_bloginfo('description');
                     }
                 }
             } else {
                 if (is_singular()) {
                     global $post;
                     if (empty($post)) {
                         $post = $wp_query->get_queried_object();
                     }
                     $fixed_title = wpseo_get_value('title');
                     if ($fixed_title) {
                         $title = $fixed_title;
                     } else {
                         if (isset($options['title-' . $post->post_type]) && !empty($options['title-' . $post->post_type])) {
                             $title = wpseo_replace_vars($options['title-' . $post->post_type], (array) $post);
                         } else {
                             $title = apply_filters('single_post_title', $title);
                             $title = $title . $sep . get_bloginfo('name');
                         }
                     }
                 } else {
                     if (is_search()) {
                         if (isset($options['title-search']) && !empty($options['title-search'])) {
                             $title = wpseo_replace_vars($options['title-search'], (array) $wp_query->get_queried_object());
                         } else {
                             $title = __('Search for "') . get_search_query() . '"';
                             if (isset($wp_query->query_vars['paged']) && $wp_query->query_vars['paged']) {
                                 $title .= $sep . $wp_query->query_vars['paged'] . '/' . $wp_query->max_num_pages;
                             }
                             $title .= $sep . get_bloginfo('name');
                         }
                     } else {
                         if (is_category() || is_tag() || is_tax()) {
                             $term = $wp_query->get_queried_object();
                             $title = trim(wpseo_get_term_meta($term, $term->taxonomy, 'title'));
                             if (!$title || empty($title)) {
                                 if (isset($options['title-' . $term->taxonomy]) && !empty($options['title-' . $term->taxonomy])) {
                                     $title = wpseo_replace_vars($options['title-' . $term->taxonomy], (array) $term);
                                 } else {
                                     if (is_category()) {
                                         $title = single_cat_title('', false);
                                     } else {
                                         if (is_tag()) {
                                             $title = single_tag_title('', false);
                                         } else {
                                             if (is_tax()) {
                                                 if (function_exists('single_term_title')) {
                                                     $title = single_term_title('', false);
                                                 } else {
                                                     $term = $wp_query->get_queried_object();
                                                     $title = $term->name;
                                                 }
                                             }
                                         }
                                     }
                                     if (isset($wp_query->query_vars['paged']) && $wp_query->query_vars['paged']) {
                                         $title .= $sep . $wp_query->query_vars['paged'] . '/' . $wp_query->max_num_pages;
                                     }
                                     $title .= $sep . get_bloginfo('name');
                                 }
                             }
                         } else {
                             if (is_author()) {
                                 $author_id = get_query_var('author');
                                 $title = get_the_author_meta('wpseo_title', $author_id);
                                 if (empty($title)) {
                                     if (isset($options['title-author']) && !empty($options['title-author'])) {
                                         $title = wpseo_replace_vars($options['title-author'], array());
                                     } else {
                                         $title = get_the_author_meta('display_name', $author_id);
                                         if (isset($wp_query->query_vars['paged']) && $wp_query->query_vars['paged']) {
                                             $title .= $sep . $wp_query->query_vars['paged'] . '/' . $wp_query->max_num_pages;
                                         }
                                         $title .= $sep . get_bloginfo('name');
                                     }
                                 }
                             } else {
                                 if (function_exists('is_post_type_archive') && is_post_type_archive()) {
                                     $post_type = get_post_type();
                                     if (isset($options['title-ptarchive-' . $post_type]) && '' != $options['title-ptarchive-' . $post_type]) {
                                         $title = $options['title-ptarchive-' . $post_type];
                                     } else {
                                         $post_type_obj = get_post_type_object($post_type);
                                         $title = $post_type_obj->labels->menu_name . $sep . get_bloginfo('name');
                                     }
                                 } else {
                                     if (is_archive()) {
                                         if (isset($options['title-archive']) && !empty($options['title-archive'])) {
                                             $title = wpseo_replace_vars($options['title-archive'], array('post_title' => $title));
                                         } else {
                                             if (is_month()) {
                                                 $title = single_month_title(' ', false) . ' ' . __('Archives');
                                             } else {
                                                 if (is_year()) {
                                                     $title = get_query_var('year') . ' ' . __('Archives');
                                                 }
                                             }
                                             if (isset($wp_query->query_vars['paged']) && $wp_query->query_vars['paged']) {
                                                 $title .= $sep . $wp_query->query_vars['paged'] . '/' . $wp_query->max_num_pages;
                                             }
                                             $title .= $sep . get_bloginfo('name');
                                         }
                                     } else {
                                         if (is_404()) {
                                             if (isset($options['title-404']) && !empty($options['title-404'])) {
                                                 $title = wpseo_replace_vars($options['title-404'], array('post_title' => $title));
                                             } else {
                                                 $title = __('Page not found') . $sep . get_bloginfo('name');
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return esc_html(strip_tags(stripslashes(apply_filters('wpseo_title', $title))));
 }