Exemplo n.º 1
0
function get_breadcrumbs($post)
{
    echo "<li itemscope itemtype=\"http://data-vocabulary.org/Breadcrumb\"><a href=" . get_bloginfo('url') . " itemprop=\"url\"><span itemprop=\"title\">Home</span></a><span class=arrow>&nbsp;&nbsp;>&nbsp;&nbsp;</span></li>";
    if (is_home()) {
        $breadcrumbs[] = '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="' . get_permalink($page->ID) . '" title="" itemprop="url"><span itemprop="title">' . single_post_title($page->ID) . '</span></a><span class=arrow>&nbsp;&nbsp;>&nbsp;&nbsp;</span></li>';
    } elseif (is_single() || is_page()) {
        $parent_id = $post->post_parent;
        $breadcrumbs = array();
        while ($parent_id) {
            $page = get_page($parent_id);
            $breadcrumbs[] = '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="' . get_permalink($page->ID) . '" title="" itemprop="url"><span itemprop="title">' . get_the_title($page->ID) . '</span></a><span class=arrow>&nbsp;&nbsp;>&nbsp;&nbsp;</span></li>';
            $parent_id = $page->post_parent;
        }
        $breadcrumbs = array_reverse($breadcrumbs);
        foreach ($breadcrumbs as $crumb) {
            echo $crumb;
        }
        echo "<li itemscope itemtype=\"http://data-vocabulary.org/Breadcrumb\"><span itemprop=\"title\">" . $post->post_title . "</span></li>";
    } elseif (is_category()) {
        echo '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="' . get_permalink($page->ID) . '" title="" itemprop="url"><span itemprop="title">' . single_cat_title($page->ID) . '</span></a></li>';
    } elseif (is_archive()) {
        echo '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><span itemprop="title">Archives</span></li>';
    } elseif (is_404()) {
        echo '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><span itemprop="title">404 Page Not Found</span></li>';
    }
}
Exemplo n.º 2
0
function ubik_title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            $title = get_the_title(get_option('page_for_posts', true));
        } else {
            $title = __('Latest posts', 'ubik');
        }
    } elseif (is_archive()) {
        $title = ubik_title_archives();
    } elseif (is_search()) {
        if (trim(get_search_query()) === '') {
            $title = __('No search query entered', 'ubik');
        } else {
            $title = sprintf(__('Search results for &ldquo;%s&rdquo;', 'ubik'), '<mark>' . trim(get_search_query()) . '</mark>');
        }
    } elseif (is_404()) {
        $title = __('Page not found', 'ubik');
    } elseif (is_singular()) {
        $title = single_post_title('', false);
    } else {
        $title = get_the_title();
    }
    return apply_filters('ubik_title', $title);
}
 public function get_value()
 {
     if (is_singular() && post_type_supports(get_post_type(), 'title')) {
         return single_post_title('', false);
     }
     return false;
 }
Exemplo n.º 4
0
function px_verified_check_user_topic($have_posts)
{
    if (is_user_logged_in()) {
        global $wp_roles;
        $current_user = wp_get_current_user();
        $roles = $current_user->roles;
        $role = array_shift($roles);
        $forum_name = single_post_title('', false);
        if ($role == 'bbp_keymaster' || $role == 'bbp_moderator' || $role == 'administrator' || $role == 'editor') {
        } else {
            if ($role == 'px_wpba_customer' && $forum_name == 'WordPress Blog Android App' || $forum_name == 'WP Google Cloud Messaging' || $forum_name == 'Special Threads from us') {
            } else {
                if ($role == 'px_wpgcm_customer' && $forum_name == 'WP Google Cloud Messaging' || $forum_name == 'Special Threads from us') {
                } else {
                    echo '<div class="bbp-template-notice"><p>Sorry, but you do not have the capability to view this forum</p></div>';
                    return $have_posts = null;
                }
            }
        }
        return $have_posts;
    } else {
        echo '<div class="bbp-template-notice"><p>Sorry, but you do not have the capability to view this topic</p></div>';
        return $have_posts = null;
    }
}
Exemplo n.º 5
0
/**
 * Customize the <title> tag content for the Tag Gallery and Single Image pages
 *
 * @param string The default page title
 * @param string $sep How to separate the various items within the page title
 * @param string $seplocation Optional. Direction to display title, 'right'.
 *
 * @return string updated title value
 */
function mla_wp_title_filter($title, $sep, $seplocation)
{
    $sep = " {$sep} ";
    if (is_page()) {
        $page = single_post_title('', false);
        /*
         * Match specific page titles and replace the default, page title,
         * with more interesting term or file information.
         */
        if ('Tag Gallery' == $page) {
            $taxonomy = isset($_REQUEST['my_taxonomy']) ? $_REQUEST['my_taxonomy'] : NULL;
            $slug = isset($_REQUEST['my_term']) ? $_REQUEST['my_term'] : NULL;
            if ($taxonomy && $slug) {
                $term = get_term_by('slug', $slug, $taxonomy);
                return $term->name . $sep;
            }
        } elseif ('Single Image' == $page) {
            $post_id = isset($_REQUEST['post_id']) ? $_REQUEST['post_id'] : 0;
            if ($post_id) {
                $file = get_attached_file($post_id);
                $pathinfo = pathinfo($file);
                return $pathinfo['basename'] . $sep;
            }
        }
    }
    // is_page
    return $title;
}
function smarty_single_post_title($params)
{
    $display = '';
    $prefix = '';
    extract($params);
    return single_post_title($prefix, $display);
}
Exemplo n.º 7
0
function get_title()
{
    // Récupère la catégorie / étiquette
    if (is_tag()) {
        $term_id = get_query_var('tag_id');
        $taxonomy = 'post_tag';
        $args = 'include=' . $term_id;
        $term = get_terms($taxonomy, $args);
        echo $term[0]->name;
    } else {
        if (is_category()) {
            $cat_id = get_query_var('cat');
            $taxonomy = 'category';
            $args = 'include=' . $cat_id;
            $term = get_terms($taxonomy, $args);
            echo $term[0]->name;
        } else {
            if (is_home()) {
                single_post_title();
            } else {
                the_title();
            }
        }
    }
}
Exemplo n.º 8
0
function meta_title()
{
    if (is_single()) {
        single_post_title();
        echo ' | ';
        bloginfo('name');
    } elseif (is_home() || is_front_page()) {
        bloginfo('name');
        if (get_bloginfo('description')) {
            echo ' | ';
            bloginfo('description');
            get_page_number();
        }
    } elseif (is_page()) {
        single_post_title('');
        echo ' | ';
        bloginfo('name');
    } elseif (is_search()) {
        printf(__('有关 %s 的搜索结果:'), '"' . get_search_query() . '"');
        get_page_number();
        echo ' | ';
        bloginfo('name');
    } elseif (is_404()) {
        _e('404 Not Found', 'Arnold');
        echo ' | ';
        bloginfo('name');
    } else {
        wp_title('');
        echo ' | ';
        bloginfo('name');
        get_page_number();
    }
}
Exemplo n.º 9
0
function cargopress_title() {
  if ( is_single() ) { single_post_title(); }
  elseif ( is_home() || is_front_page() ) { bloginfo('name'); print ' | '; bloginfo('description'); get_page_number(); }
  elseif ( is_page() ) { single_post_title(''); }
  elseif ( is_search() ) { bloginfo('name'); print ' | Search results for ' . wp_specialchars($s); get_page_number(); }
  elseif ( is_404() ) { bloginfo('name'); print ' | Not Found'; }
  else { bloginfo('name'); wp_title('|'); get_page_number(); }
}
 /** @see WP_Widget::widget */
 function widget($args, $instance)
 {
     $this->instance = $instance;
     extract($args);
     $title_rel = apply_filters('widget_title', $instance['title_rel']);
     $title_top = apply_filters('widget_title', $instance['title_top']);
     $width = !empty($instance['width']) ? $instance['width'] : 0;
     $break = !empty($instance['break']) ? $instance['break'] : '...';
     $custom_terms_top = !empty($instance['custom_terms_top']) ? $instance['custom_terms_top'] : '';
     $front_show = !empty($instance['front_show']) ? $instance['front_show'] : 'show';
     $posts_show = !empty($instance['front_show']) ? $instance['posts_show'] : 'show_related';
     $search_show = !empty($instance['front_show']) ? $instance['search_show'] : 'show_related';
     $show_approved = !empty($instance['show_approved']) ? $instance['show_approved'] : false;
     $period_limit = !empty($instance['period_limit']) ? intval($instance['period_limit']) : '';
     $show_widget = false;
     //if it is post
     if (is_search() && $search_show != 'hide') {
         $limit = !empty($instance['search_limit']) ? $instance['search_limit'] : 10;
         if ($search_show == 'show_related') {
             $title = $title_rel;
             $words_html = $this->get_related(get_search_query(), $limit, $width, $break, $show_approved);
         }
         if (empty($words_html) || $search_show == 'show_top') {
             $title = $title_top;
             $words_html = $this->get_top($limit, $width, $break, $custom_terms_top, $show_approved, $period_limit);
         }
         $show_widget = true;
     } else {
         if (is_singular() && $posts_show != 'hide') {
             $limit = !empty($instance['posts_limit']) ? $instance['posts_limit'] : 10;
             if ($posts_show == 'show_related') {
                 $title = $title_rel;
                 $keywords = single_post_title('', false);
                 $words_html = $this->get_related($keywords, $limit, $width, $break, $show_approved);
             }
             if (empty($words_html) || $posts_show == 'show_top') {
                 $title = $title_top;
                 $words_html = $this->get_top($limit, $width, $break, $custom_terms_top, $show_approved, $period_limit);
             }
             $show_widget = true;
         } else {
             if ($front_show != 'hide') {
                 $title = $title_top;
                 $limit = !empty($instance['front_limit']) ? $instance['front_limit'] : 10;
                 $words_html = $this->get_top($limit, $width, $break, $custom_terms_top, $show_approved, $period_limit);
                 $show_widget = true;
             }
         }
     }
     if ($show_widget) {
         echo $before_widget;
         if ($title) {
             echo $before_title . $title . $after_title;
         }
         echo $words_html;
         echo $after_widget;
     }
 }
Exemplo n.º 11
0
function meta_desc()
{
    global $post;
    if (is_single()) {
        $strings = preg_split('/(\\.|!|\\?)\\s/', strip_tags($post->post_content), 2, PREG_SPLIT_DELIM_CAPTURE);
        return single_post_title('', true) . ". " . $strings[0] . $strings[1] . " [...]";
    } else {
        return get_option('metadesc');
    }
}
Exemplo n.º 12
0
 function scan_title($title)
 {
     global $post;
     if (trim($title) == trim(single_post_title('', false))) {
         $post->comment_status = "close";
         $post->post_password = "";
         return $this->controller->title;
     } else {
         return $title;
     }
 }
Exemplo n.º 13
0
function brickyard_open_graph()
{
    if (is_single() || is_page()) {
        global $wp_query;
        $brickyard_postid = $wp_query->post->ID;
        $brickyard_title = single_post_title('', false);
        $brickyard_title_esc = esc_attr($brickyard_title);
        $brickyard_url = get_permalink($brickyard_postid);
        $brickyard_blogname = get_bloginfo('name');
        echo "\n<meta property='og:title' content='{$brickyard_title_esc}' />", "\n<meta property='og:site_name' content='{$brickyard_blogname}' />", "\n<meta property='og:url' content='{$brickyard_url}' />", "\n<meta property='og:type' content='article' />";
    }
}
Exemplo n.º 14
0
 function generate_button($preview, $use_own_image, $is_feed)
 {
     /**
      * if preview == TRUE && $use_own_image == '0', prepare fake link and output standard button
      * if preview == FALSE && $use_own_image == '0', prepare real link and output standard button
      * if preview == FALSE && $use_own_image == '1', prepare real link and output custom button
      * if preview == TRUE && $use_own_image == '1', impossible
      * the button is inside, so let's prepare button first
      */
     $button_defaults = $this->button_defaults;
     $options_array = get_option('share-on-diaspora-settings');
     if ($use_own_image) {
         //use own image
         $button_box = "<span id='diaspora-button-ownimage-div'><img id='diaspora-button-ownimage-img' src='" . $options_array['image_file'] . "' alt=''/></span>";
     } else {
         //use standard image
         switch ($options_array['button_size']) {
             case '2':
                 $bs = '28';
                 break;
             case '3':
                 $bs = '33';
                 break;
             case '4':
                 $bs = '48';
                 break;
             default:
                 $bs = '23';
         }
         $bt = !empty($options_array['button_text']) ? $options_array['button_text'] : $button_defaults['button_text'];
         $button_box = "<span id='diaspora-button-box'><font>" . $bt . "</font> <span id='diaspora-button-inner'><img src='" . SHARE_ON_DIASPORA_PLUGIN_URL . 'images/asterisk-' . ($bs - 3) . ".png' alt=''/></span></span>";
     }
     if ($preview || is_admin()) {
         //add fake link
         $url = "[" . __('Page address here', 'share-on-diaspora') . "]";
         $title = "[" . __('Page title here', 'share-on-diaspora') . "]";
     } elseif (is_single()) {
         //add real link from DOM
         $url = esc_url(get_permalink());
         $title = single_post_title('', false);
     } else {
         //add real link from WP
         $url = esc_url(get_permalink());
         $title = get_the_title();
     }
     // javascript not allowed in rss feed files
     if ($is_feed) {
         $button = "<a href='" . SHARE_ON_DIASPORA_PLUGIN_URL . "new_window.php?url=" . rawurlencode($url) . "&amp;title=" . rawurlencode($title) . "' target='_blank'>" . $button_box . "</a>";
     } else {
         $button = "<div title='Diaspora*' id='diaspora-button-container'><a href=\"javascript:(function(){var url = '" . $url . "' ;var title = '" . $title . "';   window.open('" . SHARE_ON_DIASPORA_PLUGIN_URL . "new_window.php?url='+encodeURIComponent(url)+'&amp;title='+encodeURIComponent(title),'post','location=no,links=no,scrollbars=no,toolbar=no,width=620,height=400')})()\">" . $button_box . '</a></div>';
     }
     return $button;
 }
 function thematic_doctitle()
 {
     $site_name = get_bloginfo('name');
     $separator = '|';
     if (is_single()) {
         $content = single_post_title('', FALSE);
     } elseif (is_home() || is_front_page()) {
         $content = get_bloginfo('description');
     } elseif (is_page()) {
         $content = single_post_title('', FALSE);
     } elseif (is_search()) {
         $content = __('Search Results for:', 'thematic');
         $content .= ' ' . esc_html(stripslashes(get_search_query()));
     } elseif (is_category()) {
         $content = __('Category Archives:', 'thematic');
         $content .= ' ' . single_cat_title("", false);
     } elseif (is_tag()) {
         $content = __('Tag Archives:', 'thematic');
         $content .= ' ' . thematic_tag_query();
     } elseif (is_404()) {
         $content = __('Not Found', 'thematic');
     } else {
         $content = get_bloginfo('description');
     }
     if (get_query_var('paged')) {
         $content .= ' ' . $separator . ' ';
         $content .= 'Page';
         $content .= ' ';
         $content .= get_query_var('paged');
     }
     if ($content) {
         if (is_home() || is_front_page()) {
             $elements = array('site_name' => $site_name, 'separator' => $separator, 'content' => $content);
         } else {
             $elements = array('content' => $content);
         }
     } else {
         $elements = array('site_name' => $site_name);
     }
     // Filters should return an array
     $elements = apply_filters('thematic_doctitle', $elements);
     // But if they don't, it won't try to implode
     if (is_array($elements)) {
         $doctitle = implode(' ', $elements);
     } else {
         $doctitle = $elements;
     }
     $doctitle = "\t" . "<title>" . $doctitle . "</title>" . "\n\n";
     echo $doctitle;
 }
Exemplo n.º 16
0
function get_breadcrumbs()
{
    //	$xoops_breadcrumbs[0] = array( 'name' => get_bloginfo('description') , 'url' => get_settings('home'));
    $xoops_breadcrumbs[0] = array('name' => get_bloginfo('name'), 'url' => get_settings('home'));
    $pagetitle = '';
    if (is_category()) {
        $this_cat = get_category($cat);
        $p_count = 0;
        while ($this_cat->parent) {
            $this_cat = get_category($this_cat->parent);
            $cat_parrent[$p_count] = array('name' => $this_cat->cat_name, 'url' => get_category_link($this_cat->cat_ID));
            $p_count++;
        }
        for ($i = 1; $i <= $p_count; $i++) {
            $xoops_breadcrumbs[$i] = $cat_parrent[$p_count - $i];
        }
        $xoops_breadcrumbs[$p_count + 1] = array('name' => single_cat_title('', false));
    } elseif (is_day()) {
        $xoops_breadcrumbs[1] = array('name' => get_the_time(__('F j, Y')));
    } elseif (is_month()) {
        $xoops_breadcrumbs[1] = array('name' => get_the_time(__('F, Y')));
    } elseif (is_year()) {
        $xoops_breadcrumbs[1] = array('name' => get_the_time('Y'));
    } elseif (is_author()) {
        $xoops_breadcrumbs[1] = array('name' => get_author_name(get_query_var('author')));
    } elseif (is_single()) {
        $xoops_breadcrumbs[1] = array('name' => single_post_title('', false));
    } elseif (is_page()) {
        $now_page = get_page($page_id);
        $this_page = $now_page;
        $p_count = 0;
        while ($this_page->post_parent) {
            $this_page = get_page($this_page->post_parent);
            $page_parrent[$p_count] = array('name' => $this_page->post_title, 'url' => get_permalink($this_page->ID));
            $p_count++;
        }
        for ($i = 1; $i <= $p_count; $i++) {
            $xoops_breadcrumbs[$i] = $page_parrent[$p_count - $i];
        }
        $xoops_breadcrumbs[$p_count + 1] = array('name' => $now_page->post_title);
    } elseif (is_search()) {
        $xoops_breadcrumbs[1] = array('name' => $pagetitle);
    } elseif (function_exists('is_tag')) {
        if (is_tag()) {
            $xoops_breadcrumbs[1] = array('name' => single_tag_title('', false));
        }
    }
    return $xoops_breadcrumbs;
}
Exemplo n.º 17
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;
}
Exemplo n.º 18
0
/**
 * Title optimize
 */
function seo_title()
{
    global $page, $paged;
    $sep = " - ";
    # delimiter
    $newtitle = get_bloginfo('name');
    # default title
    # Single & Page
    if (is_single() || is_page()) {
        $newtitle = single_post_title("", false);
    }
    # Category
    if (is_category()) {
        $newtitle = single_cat_title("", false);
    }
    # Tag
    if (is_tag()) {
        $newtitle = single_tag_title("", false);
    }
    # Search result
    if (is_search()) {
        $newtitle = "Search Result " . $s;
    }
    # Taxonomy
    if (is_tax()) {
        $curr_tax = get_taxonomy(get_query_var('taxonomy'));
        $curr_term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
        # current term data
        # if it's term
        if (!empty($curr_term)) {
            $newtitle = $curr_tax->label . $sep . $curr_term->name;
        } else {
            $newtitle = $curr_tax->label;
        }
    }
    # Page number
    if ($paged >= 2 || $page >= 2) {
        $newtitle .= $sep . sprintf('第%页', max($paged, $page));
    }
    # Home & Front Page ########################################
    if (is_home() || is_front_page()) {
        $newtitle = get_bloginfo('name') . $sep . get_bloginfo('description');
    } else {
        $newtitle .= $sep . get_bloginfo('name');
    }
    return $newtitle;
}
Exemplo n.º 19
0
/**
 * Filters the `wp_title` output early. Note that since WordPress 4.1.0 introduced the `_wp_render_title_tag()`
 * function, theme authors can no longer control this on their own. In the past, Hybrid Core defaulted to
 * a colon, so we're overwriting this regardless of what it was defined as. Later filters on `wp_title` can
 * change if needed.  Since core is now defining the separator, this shouldn't be an issue.
 *
 * @since  2.0.0
 * @access publc
 * @param  string  $title
 * @return string
 */
function hybrid_wp_title($doctitle)
{
    // Custom separator for backwards compatibility.
    $separator = ':';
    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 = hybrid_get_single_author_title();
    } elseif (get_query_var('minute') && get_query_var('hour')) {
        $doctitle = hybrid_get_single_minute_hour_title();
    } elseif (get_query_var('minute')) {
        $doctitle = hybrid_get_single_minute_title();
    } elseif (get_query_var('hour')) {
        $doctitle = hybrid_get_single_hour_title();
    } elseif (is_day()) {
        $doctitle = hybrid_get_single_day_title();
    } elseif (get_query_var('w')) {
        $doctitle = hybrid_get_single_week_title();
    } elseif (is_month()) {
        $doctitle = single_month_title(' ', false);
    } elseif (is_year()) {
        $doctitle = hybrid_get_single_year_title();
    } elseif (is_archive()) {
        $doctitle = hybrid_get_single_archive_title();
    } elseif (is_search()) {
        $doctitle = hybrid_get_search_title();
    } elseif (is_404()) {
        $doctitle = hybrid_get_404_title();
    }
    // 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', 'hybrid-core'), $doctitle . $separator, number_format_i18n(absint($page)));
    }
    // Trim separator + space from beginning and end.
    return trim(strip_tags($doctitle), "{$separator} ");
}
Exemplo n.º 20
0
/**
 * bf_document_title() - Document Title Function
 * 
 * Prints out SEO optimized document title based on the page the user is in.
 * 
 * @hook	filter	bf_document_title
 * @uses	bf_get_page_no()
 * @since	0.5.2
 */
function bf_document_title()
{
    global $s;
    $output = '';
    if (function_exists('seo_title_tag')) {
        seo_title_tag();
        return null;
    } else {
        if (class_exists('All_in_One_SEO_Pack') || class_exists('HeadSpace2_Admin')) {
            if (is_front_page() || is_home()) {
                echo get_bloginfo('name') . ': ' . get_bloginfo('description');
                $output = get_bloginfo('name') . ': ' . get_bloginfo('description');
            } else {
                $output = wp_title('', false);
            }
        } else {
            if (is_attachment()) {
                $output = get_bloginfo('name') . ' | ' . single_post_title('', false);
            } else {
                if (is_single()) {
                    $output = single_post_title('', false);
                } else {
                    if (is_home()) {
                        $output = get_bloginfo('name') . ' | ' . get_bloginfo('description') . bf_get_page_no();
                    } else {
                        if (is_page()) {
                            $output = single_post_title('', false);
                        } else {
                            if (is_search()) {
                                $output = get_bloginfo('name') . ' | ' . sprintf(__('Search results for %s', 'arras'), wp_specialchars($s)) . bf_get_page_no();
                            } else {
                                if (is_404()) {
                                    $output = get_bloginfo('name') . ' | ' . __('Not Found', 'arras');
                                } else {
                                    $output = get_bloginfo('name') . wp_title('|', false) . bf_get_page_no();
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    echo apply_filters('bf_document_title', $output);
}
Exemplo n.º 21
0
 /**
  * Sets basic info
  *
  * @access protected
  * @return void
  */
 protected function _defineTitle()
 {
     $blogName = get_option('blogname');
     $metaTitle = $blogName;
     $pageTitle = wp_title('', false);
     if (single_post_title('', false) != "") {
         $pageTitle = single_post_title('', false);
     }
     if ($pageTitle != "") {
         $metaTitle = $metaTitle . " | " . $pageTitle;
     } else {
         $pageTitle = $metaTitle;
     }
     //Page title
     $this->data["blogName"] = $blogName;
     $this->data["pageTitle"] = $pageTitle;
     $this->data["metaTitle"] = $metaTitle;
 }
Exemplo n.º 22
0
/**
 * @return string
 */
function document_title()
{
    global $s;
    if (function_exists('seo_title_tag')) {
        seo_title_tag();
        return null;
    } else {
        if (class_exists('All_in_One_SEO_Pack') || class_exists('Platinum_SEO_Pack') || class_exists('WPSEO_Frontend')) {
            if (is_front_page() || is_home()) {
                $output = get_bloginfo('name') . ' &#8212; ' . get_bloginfo('description');
            } else {
                $output = wp_title('', false);
            }
        } else {
            if (is_attachment()) {
                $output = get_bloginfo('name') . ' &#8212; ' . single_post_title('', false);
            } else {
                if (is_single()) {
                    $output = single_post_title('', false);
                } else {
                    if (is_home()) {
                        $output = get_bloginfo('name') . ' &#8212; ' . get_bloginfo('description');
                    } else {
                        if (is_page()) {
                            $output = single_post_title('', false);
                        } else {
                            if (is_search()) {
                                $output = get_bloginfo('name') . ' &#8212; ' . sprintf(__('Результаты поиска для: %s'), esc_html($s));
                            } else {
                                if (is_404()) {
                                    $output = get_bloginfo('name') . ' &#8212; ' . __('Ничего не найдено.');
                                } else {
                                    $output = get_bloginfo('name') . wp_title('&#8212;', false);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    echo apply_filters('document_title', $output);
}
Exemplo n.º 23
0
function arras_document_title()
{
    if (function_exists('seo_title_tag')) {
        seo_title_tag();
    } else {
        if (class_exists('All_in_One_SEO_Pack') || class_exists('HeadSpace2_Admin')) {
            if (is_front_page() || is_home()) {
                echo get_bloginfo('name') . ': ' . get_bloginfo('description');
            } else {
                wp_title('');
            }
        } else {
            if (is_attachment()) {
                bloginfo('name');
                print ' | ';
                single_post_title('');
            } elseif (is_single()) {
                single_post_title();
            } elseif (is_home()) {
                bloginfo('name');
                print ' | ';
                bloginfo('description');
                arras_get_page_no();
            } elseif (is_page()) {
                single_post_title('');
            } elseif (is_search()) {
                bloginfo('name');
                print ' | Search results for ' . wp_specialchars($s);
                arras_get_page_no();
            } elseif (is_404()) {
                bloginfo('name');
                print ' | Not Found';
            } else {
                bloginfo('name');
                wp_title('|');
                arras_get_page_no();
            }
        }
    }
}
function facebook_open_graph_init()
{
    global $fbappID, $fbadminID, $fbimage;
    if (have_posts()) {
        while (have_posts()) {
            the_post();
        }
    }
    $title = single_post_title('', FALSE);
    $url = get_permalink();
    echo <<<EOD

<!-- Facebook Open Graph --> 
<meta property="fb:app_id" content="{$fbappID}" />
<meta property="fb:admins" content="{$fbadminID}" />

EOD;
    if (is_single() || is_page()) {
        $description = strip_tags(get_the_excerpt($post->ID));
        $image = get_first_image();
        echo <<<EOD
<meta property="og:title" content="{$title}" />
<meta property="og:description" content="{$description}" />
<meta property="og:type" content="article" />
<meta property="og:image" content="{$image}" />
<meta property="og:url" content="{$url}"/>
EOD;
    } else {
        $sitename = get_bloginfo('name');
        $description = get_bloginfo('description');
        $url = get_bloginfo('url');
        echo <<<EOD
<meta property="og:site_name" content="{$sitename}" />
<meta property="og:description" content="{$description}" />
<meta property="og:type" content="website" />
<meta property="og:image" content="{$fbimage}" />
<meta property="og:url" content="{$url}"/>
EOD;
    }
}
Exemplo n.º 25
0
function wpflex_title_filter($title)
{
    global $wp_query, $s, $paged, $page;
    if (!is_feed()) {
        $sep = __('&raquo;');
        $new_title = get_bloginfo('name') . ' ';
        $bloginfo_description = get_bloginfo('description');
        if ((is_home() || is_front_page()) && !empty($bloginfo_description) && !$paged && !$page) {
            $new_title .= $sep . ' ' . $bloginfo_description;
        } elseif (is_single() || is_page()) {
            $new_title .= $sep . ' ' . single_post_title('', false);
        } elseif (is_search()) {
            $new_title .= $sep . ' ' . sprintf(__('Search Results: %s'), esc_html($s));
        } else {
            $new_title .= $title;
        }
        if ($paged || $page) {
            $new_title .= ' ' . $sep . ' ' . sprintf(__('Page: %s'), max($paged, $page));
        }
        $title = $new_title;
    }
    return $title;
}
Exemplo n.º 26
0
function page_title($content = '')
{
    $title_content = '';
    if (is_single()) {
        $title_content = single_post_title();
    } elseif (is_home()) {
        $title_content = bloginfo('name');
        print ' | ';
        bloginfo('description');
    } elseif (is_page()) {
        $title_content = single_post_title('');
    } elseif (is_search()) {
        $title_content = bloginfo('name');
        print ' | Search results for ' . wp_specialchars($s);
    } elseif (is_404()) {
        $title_content = bloginfo('name');
        print ' | Not Found';
    } else {
        $title_content = bloginfo('name');
        wp_title('|');
    }
    echo "{$title_content} : {$content}";
}
Exemplo n.º 27
0
function grngrdn_wp_title($title, $sep)
{
    /*customize site title*/
    global $paged, $page;
    if (is_feed()) {
        return $title;
    }
    /* Add the site name. */
    $site_title = get_bloginfo('name');
    /* Add the site description for the home/front page. */
    $site_description = get_bloginfo('description', 'display');
    $sep = '&laquo;';
    if (is_single() || is_home() && !is_front_page() || is_page() && !is_front_page()) {
        $title = single_post_title('', false) . " {$sep} {$site_title}";
    }
    //	$title = "$site_title $sep $site_description";
    if ($site_description && (is_home() || is_front_page())) {
        $title = "{$site_title} {$sep} {$site_description}";
    }
    /* Add a page number if necessary. */
    if (2 <= $paged || 2 <= $page) {
        $title = "{$title} {$sep} " . sprintf(__('Page', 'grngrdn') . '&nbsp;%s', max($paged, $page));
    }
    if (is_category()) {
        $title = sprintf(__('Category:', 'grngrdn')) . "&nbsp;{$title}";
    }
    if (is_tag()) {
        $title = sprintf(__('Tag:', 'grngrdn')) . "&nbsp;{$title}";
    }
    if (is_search()) {
        $title = sprintf(__('Searching for:', 'grngrdn')) . "&nbsp;{$title}";
    }
    if (is_404()) {
        $title = '404' . "&nbsp;{$title}";
    }
    return $title;
}
 public function title()
 {
     $title = '';
     // Single post
     if (is_single()) {
         $title .= single_post_title('', false);
         $title .= ' | ';
         $title .= get_bloginfo('name');
     } elseif (is_home()) {
         $title .= get_bloginfo('name');
         $title .= ' | ';
         $title .= get_bloginfo('description');
         if (get_query_var('paged')) {
             $title .= ' | ' . __('Page', 'pressabl') . ' ' . get_query_var('paged');
         }
     } elseif (is_page()) {
         $title .= single_post_title('', false);
         $title .= ' | ';
         $title .= get_bloginfo('name');
     } elseif (is_search()) {
         $title .= get_bloginfo('name');
         $title .= ' | Search results for ' . esc_html($s);
         if (get_query_var('paged')) {
             $title .= ' | ' . __('Page', 'pressabl') . ' ' . get_query_var('paged');
         }
     } elseif (is_404()) {
         $title .= get_bloginfo('name');
         $title .= ' | ' . __('Not Found', 'pressabl');
     } else {
         $title .= get_bloginfo('name');
         if (get_query_var('paged')) {
             $title .= ' | ' . __('Page', 'pressabl') . ' ' . get_query_var('paged');
         }
     }
     return $title;
 }
get_header();
?>

	<div id="primary" class="content-area">
		<main id="main" class="site-main" role="main">

		<?php 
if (have_posts()) {
    ?>

			<?php 
    if (is_home() && !is_front_page()) {
        ?>
				<header>
					<h1 class="page-title screen-reader-text"><?php 
        single_post_title();
        ?>
</h1>
				</header>
			<?php 
    }
    ?>

			<?php 
    // Start the loop.
    while (have_posts()) {
        the_post();
        /*
         * Include the Post-Format-specific template for the content.
         * If you want to override this in a child theme, then include a file
         * called content-___.php (where ___ is the Post Format name) and that will be used instead.
Exemplo n.º 30
0
 function meta_title()
 {
     if (is_single()) {
         single_post_title();
         echo ' | ';
         bloginfo('name');
     } elseif (is_home() || is_front_page()) {
         bloginfo('name');
         if (get_bloginfo('description')) {
             echo ' | ';
             bloginfo('description');
             $this->page_number();
         }
     } elseif (is_page()) {
         single_post_title('');
         echo ' | ';
         bloginfo('name');
     } elseif (is_search()) {
         printf(__('Search results for %s', 'themater'), '"' . get_search_query() . '"');
         $this->page_number();
         echo ' | ';
         bloginfo('name');
     } elseif (is_404()) {
         _e('Not Found', 'themater');
         echo ' | ';
         bloginfo('name');
     } else {
         wp_title('');
         echo ' | ';
         bloginfo('name');
         $this->page_number();
     }
 }