本文整理汇总了PHP中genesis_has_post_type_archive_support函数的典型用法代码示例。如果您正苦于以下问题:PHP genesis_has_post_type_archive_support函数的具体用法?PHP genesis_has_post_type_archive_support怎么用?PHP genesis_has_post_type_archive_support使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了genesis_has_post_type_archive_support函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: genesis_cpt_archive_settings_toolbar_styles
/**
* Add custom CSS to <head>
* Adds the pencil icon to the cpt archive settings menu link
*
* @since 2.3.0
*
* @uses genesis_has_post_type_archive_support() Check if CPT supports archive settings
*
* @return void
*/
function genesis_cpt_archive_settings_toolbar_styles()
{
// Bail if in admin, user is not logged in, admin bar is not showing, not a post type archive page, or post type does not support genesis-cpt-archive-settings
if (is_admin() || !is_user_logged_in() || !is_admin_bar_showing() || !is_post_type_archive() || !genesis_has_post_type_archive_support()) {
return;
}
echo '<style type="text/css">
#wpadminbar #wp-admin-bar-cpt-archive-settings > .ab-item:before {
content: "\\f464";
top: 2px;
}
</style>';
}
开发者ID:robalford,项目名称:alfordhomesinc,代码行数:23,代码来源:toolbar.php
示例2: archive_settings_link
/**
* Add node to admin bar
*
* @since 1.0.0
*
* @uses genesis_has_post_type_archive_support()
* @return void
*/
public function archive_settings_link($wp_admin_bar)
{
// Bail if in admin, not a CPT archive, or post_type doesn't have support for genesis-cpt-archive-settings
if (is_admin() || !is_post_type_archive() || !genesis_has_post_type_archive_support()) {
return $wp_admin_bar;
}
// Get the post type we're viewing
$post_type = get_post_type();
// Bail if we didn't get a valid post type
if (!$post_type) {
return $wp_admin_bar;
}
// Add our toolbar link
$args = array('id' => 'cpt-archive-settings', 'title' => __('Edit Archive Settings', 'genesis-cptast'), 'href' => admin_url("edit.php?post_type={$post_type}&page=genesis-cpt-archive-{$post_type}"), 'meta' => array('class' => ''));
$wp_admin_bar->add_node($args);
}
开发者ID:JiveDig,项目名称:cptast-genesis,代码行数:24,代码来源:class-cpt-archive-toolbar.php
示例3: genesis_cpt_archive_body_class
/**
* Adds a custom class to the custom post type archive body classes.
*
* It accepts a value from the archive settings page.
*
* @since 2.0.0
*
* @uses genesis_has_post_type_archive_support() Check if current CPT has archive support.
* @uses genesis_get_cpt_option() Get CPT Archive setting.
*
* @param array $classes Existing classes.
*
* @return array Amended classes.
*/
function genesis_cpt_archive_body_class(array $classes)
{
if (!is_post_type_archive() || !genesis_has_post_type_archive_support()) {
return $classes;
}
$new_class = genesis_get_cpt_option('body_class');
if ($new_class) {
$classes[] = esc_attr(sanitize_html_class($new_class));
}
return $classes;
}
开发者ID:treydonovan,项目名称:innergame-anna,代码行数:25,代码来源:layout.php
示例4: do_cpt_archive_description
/**
* Add custom headline and description to relevant custom post type archive pages.
*
* If we're not on a post type archive page, or not on page 1, then nothing extra is displayed.
*
* If there's a custom headline to display, it is marked up as a level 1 heading.
*
* If there's a description (intro text) to display, it is run through wpautop() before being added to a div.
*
* @since 2.0.0
*
* @uses genesis_has_post_type_archive_support() Check if a post type should potentially support an archive setting page.
* @uses genesis_get_cpt_option() Get list of custom post types which need an archive settings page.
*
* @return null Return early if not on relevant post type archive.
*/
public function do_cpt_archive_description()
{
if (!is_post_type_archive() || !genesis_has_post_type_archive_support()) {
return;
}
if (get_query_var('paged') >= 2) {
return;
}
$intro_text = apply_filters('display_featured_image_genesis_cpt_description', genesis_get_cpt_option('intro_text'));
if ($intro_text) {
printf('<div class="archive-description cpt-archive-description">%s</div>', wp_kses_post(wpautop($intro_text)));
}
}
开发者ID:stevepolitodesign,项目名称:nema-wordpress,代码行数:29,代码来源:class-displayfeaturedimagegenesis-description.php
示例5: genesis_robots_meta
/**
* Output the `index`, `follow`, `noodp`, `noydir`, `noarchive` robots meta code in the document `head`.
*
* @since 0.1.3
*
* @uses genesis_get_seo_option() Get SEO setting value.
* @uses genesis_get_custom_field() Get custom field value.
*
* @global WP_Query $wp_query Query object.
*
* @return null Return early if blog is not public.
*/
function genesis_robots_meta()
{
global $wp_query;
$post_id = null;
//* If the blog is private, then following logic is unnecessary as WP will insert noindex and nofollow
if (!get_option('blog_public')) {
return;
}
//* Defaults
$meta = array('noindex' => '', 'nofollow' => '', 'noarchive' => genesis_get_seo_option('noarchive') ? 'noarchive' : '', 'noodp' => genesis_get_seo_option('noodp') ? 'noodp' : '', 'noydir' => genesis_get_seo_option('noydir') ? 'noydir' : '');
//* Check root page SEO settings, set noindex, nofollow and noarchive
if (genesis_is_root_page()) {
$meta['noindex'] = genesis_get_seo_option('home_noindex') ? 'noindex' : $meta['noindex'];
$meta['nofollow'] = genesis_get_seo_option('home_nofollow') ? 'nofollow' : $meta['nofollow'];
$meta['noarchive'] = genesis_get_seo_option('home_noarchive') ? 'noarchive' : $meta['noarchive'];
}
if (is_category() || is_tag() || is_tax()) {
$term = $wp_query->get_queried_object();
$meta['noindex'] = get_term_meta($term->term_id, 'noindex', true) ? 'noindex' : $meta['noindex'];
$meta['nofollow'] = get_term_meta($term->term_id, 'nofollow', true) ? 'nofollow' : $meta['nofollow'];
$meta['noarchive'] = get_term_meta($term->term_id, 'noarchive', true) ? 'noarchive' : $meta['noarchive'];
if (is_category()) {
$meta['noindex'] = genesis_get_seo_option('noindex_cat_archive') ? 'noindex' : $meta['noindex'];
$meta['noarchive'] = genesis_get_seo_option('noarchive_cat_archive') ? 'noarchive' : $meta['noarchive'];
}
if (is_tag()) {
$meta['noindex'] = genesis_get_seo_option('noindex_tag_archive') ? 'noindex' : $meta['noindex'];
$meta['noarchive'] = genesis_get_seo_option('noarchive_tag_archive') ? 'noarchive' : $meta['noarchive'];
}
}
if (is_post_type_archive() && genesis_has_post_type_archive_support()) {
$meta['noindex'] = genesis_get_cpt_option('noindex') ? 'noindex' : $meta['noindex'];
$meta['nofollow'] = genesis_get_cpt_option('nofollow') ? 'nofollow' : $meta['nofollow'];
$meta['noarchive'] = genesis_get_cpt_option('noarchive') ? 'noarchive' : $meta['noarchive'];
}
if (is_author()) {
$meta['noindex'] = get_the_author_meta('noindex', (int) get_query_var('author')) ? 'noindex' : $meta['noindex'];
$meta['nofollow'] = get_the_author_meta('nofollow', (int) get_query_var('author')) ? 'nofollow' : $meta['nofollow'];
$meta['noarchive'] = get_the_author_meta('noarchive', (int) get_query_var('author')) ? 'noarchive' : $meta['noarchive'];
$meta['noindex'] = genesis_get_seo_option('noindex_author_archive') ? 'noindex' : $meta['noindex'];
$meta['noarchive'] = genesis_get_seo_option('noarchive_author_archive') ? 'noarchive' : $meta['noarchive'];
}
if (is_date()) {
$meta['noindex'] = genesis_get_seo_option('noindex_date_archive') ? 'noindex' : $meta['noindex'];
$meta['noarchive'] = genesis_get_seo_option('noarchive_date_archive') ? 'noarchive' : $meta['noarchive'];
}
if (is_search()) {
$meta['noindex'] = genesis_get_seo_option('noindex_search_archive') ? 'noindex' : $meta['noindex'];
$meta['noarchive'] = genesis_get_seo_option('noarchive_search_archive') ? 'noarchive' : $meta['noarchive'];
}
//* When the page is set as the Posts Page in WordPress core, use the $post_id of the page when loading SEO values
if (is_home() && get_option('page_for_posts') && get_queried_object_id()) {
$post_id = get_option('page_for_posts');
}
if (is_singular() || null !== $post_id) {
$meta['noindex'] = genesis_get_custom_field('_genesis_noindex', $post_id) ? 'noindex' : $meta['noindex'];
$meta['nofollow'] = genesis_get_custom_field('_genesis_nofollow', $post_id) ? 'nofollow' : $meta['nofollow'];
$meta['noarchive'] = genesis_get_custom_field('_genesis_noarchive', $post_id) ? 'noarchive' : $meta['noarchive'];
}
//* Strip empty array items
$meta = array_filter($meta);
//* Add meta if any exist
if ($meta) {
printf('<meta name="robots" content="%s" />' . "\n", implode(',', $meta));
}
}
开发者ID:robalford,项目名称:alfordhomesinc,代码行数:78,代码来源:header.php
示例6: genesis_add_cpt_archive_page
/**
* Add archive settings page to relevant custom post type registrations.
*
* An instance of `Genesis_Admin_CPT_Archive_Settings` is instantiated for each relevant CPT, assigned to an individual
* global variable.
*
* @since 2.0.0
*
* @uses \Genesis_Admin_CPT_Archive_Settings CPT Archive Settings page class.
* @uses genesis_get_cpt_archive_types() Get list of custom post types which need an archive settings page.
* @uses genesis_has_post_type_archive_support() Check post type has archive support.
*/
function genesis_add_cpt_archive_page()
{
$post_types = genesis_get_cpt_archive_types();
foreach ($post_types as $post_type) {
if (genesis_has_post_type_archive_support($post_type->name)) {
$admin_object_name = '_genesis_admin_cpt_archives_' . $post_type->name;
global ${$admin_object_name};
${$admin_object_name} = new Genesis_Admin_CPT_Archive_Settings($post_type);
}
}
}
开发者ID:Oak86,项目名称:matthewbuttler.work,代码行数:23,代码来源:menu.php
示例7: genesis_site_layout
/**
* Return the site layout for different contexts.
*
* Checks both the custom field and the theme option to find the user-selected site layout, and returns it.
*
* Applies `genesis_site_layout` filter early to allow shortcutting of function.
*
* @since 0.2.2
*
* @uses genesis_get_custom_field() Get per-post layout value.
* @uses genesis_get_option() Get theme setting layout value.
* @uses genesis_get_default_layout() Get default from registered layouts.
* @uses genesis_has_post_type_archive_support() Check if a post type supports an archive setting page.
*
* @global WP_Query $wp_query Query object.
*
* @param boolean $use_cache Conditional to use cache or get fresh.
*
* @return string Key of layout.
*/
function genesis_site_layout($use_cache = true)
{
//* Allow child theme to short-circuit this function
$pre = apply_filters('genesis_site_layout', null);
if (null !== $pre) {
return $pre;
}
//* If we're supposed to use the cache, setup cache. Use if value exists.
if ($use_cache) {
//* Setup cache
static $layout_cache = '';
//* If cache is populated, return value
if ('' !== $layout_cache) {
return esc_attr($layout_cache);
}
}
global $wp_query;
//* If viewing a singular page or post, or the posts page, but not the front page
if (is_singular() || is_home() && !genesis_is_root_page()) {
$post_id = is_home() ? get_option('page_for_posts') : null;
$custom_field = genesis_get_custom_field('_genesis_layout', $post_id);
$site_layout = $custom_field ? $custom_field : genesis_get_option('site_layout');
} elseif (is_category() || is_tag() || is_tax()) {
$term = $wp_query->get_queried_object();
$site_layout = $term && isset($term->meta['layout']) && $term->meta['layout'] ? $term->meta['layout'] : genesis_get_option('site_layout');
} elseif (is_post_type_archive() && genesis_has_post_type_archive_support()) {
$site_layout = genesis_get_cpt_option('layout') ? genesis_get_cpt_option('layout') : genesis_get_option('site_layout');
} elseif (is_author()) {
$site_layout = get_the_author_meta('layout', (int) get_query_var('author')) ? get_the_author_meta('layout', (int) get_query_var('author')) : genesis_get_option('site_layout');
} else {
$site_layout = genesis_get_option('site_layout');
}
//* Use default layout as a fallback, if necessary
if (!genesis_get_layout($site_layout)) {
$site_layout = genesis_get_default_layout();
}
//* Push layout into cache, if caching turned on
if ($use_cache) {
$layout_cache = $site_layout;
}
//* Return site layout
return esc_attr($site_layout);
}
开发者ID:nkeat12,项目名称:dv,代码行数:63,代码来源:layout.php
示例8: leadership_isd_page_description_meta
function leadership_isd_page_description_meta()
{
if (is_archive() && !is_post_type_archive()) {
remove_action('genesis_before_loop', 'genesis_do_taxonomy_title_description', 15);
add_action('genesis_after_header', 'leadership_isd_open_after_header', 5);
add_action('genesis_after_header', 'genesis_do_taxonomy_title_description', 10);
add_action('genesis_after_header', 'leadership_isd_close_after_header', 15);
}
if (is_post_type_archive() && genesis_has_post_type_archive_support()) {
remove_action('genesis_before_loop', 'genesis_do_cpt_archive_title_description');
add_action('genesis_after_header', 'leadership_isd_open_after_header', 5);
add_action('genesis_after_header', 'genesis_do_cpt_archive_title_description', 10);
add_action('genesis_after_header', 'leadership_isd_close_after_header', 15);
}
if (is_author()) {
remove_action('genesis_before_loop', 'genesis_do_author_title_description', 15);
add_action('genesis_after_header', 'leadership_isd_open_after_header', 5);
add_action('genesis_after_header', 'genesis_do_author_title_description', 10);
add_action('genesis_after_header', 'leadership_isd_close_after_header', 15);
}
if (is_page_template('page_blog.php') && has_excerpt()) {
remove_action('genesis_before_loop', 'genesis_do_blog_template_heading');
add_action('genesis_after_header', 'leadership_isd_open_after_header', 5);
add_action('genesis_after_header', 'leadership_isd_add_page_description', 10);
add_action('genesis_after_header', 'leadership_isd_close_after_header', 15);
} elseif (is_singular() && is_page() && has_excerpt()) {
remove_action('genesis_entry_header', 'genesis_do_post_title');
add_action('genesis_after_header', 'leadership_isd_open_after_header', 5);
add_action('genesis_after_header', 'leadership_isd_add_page_description', 10);
add_action('genesis_after_header', 'leadership_isd_close_after_header', 15);
}
if (is_post_type_archive(array('members', 'partners'))) {
remove_action('genesis_after_header', 'leadership_isd_open_after_header', 5);
remove_action('genesis_after_header', 'genesis_do_cpt_archive_title_description', 10);
remove_action('genesis_after_header', 'leadership_isd_close_after_header', 15);
remove_action('genesis_entry_header', 'genesis_post_info', 8);
}
if (is_singular('partners') || is_singular('members')) {
remove_action('genesis_entry_header', 'genesis_post_info', 8);
}
if (is_singular('partners')) {
add_action('genesis_entry_footer', 'genesis_post_meta', 10);
}
if (is_singular('members')) {
add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content');
}
}
开发者ID:dabernathy89,项目名称:leadership-isd-website,代码行数:47,代码来源:functions.php
示例9: do_cpt_archive_description
/**
* Add custom headline and description to relevant custom post type archive pages.
*
* If we're not on a post type archive page, or not on page 1, then nothing extra is displayed.
*
* If there's a custom headline to display, it is marked up as a level 1 heading.
*
* If there's a description (intro text) to display, it is run through wpautop() before being added to a div.
*
* @since 2.0.0
*
* @uses genesis_has_post_type_archive_support() Check if a post type should potentially support an archive setting page.
* @uses genesis_get_cpt_option() Get list of custom post types which need an archive settings page.
*
* @return null Return early if not on relevant post type archive.
*/
public function do_cpt_archive_description()
{
if (!is_post_type_archive() || !genesis_has_post_type_archive_support()) {
return;
}
if (get_query_var('paged') >= 2) {
return;
}
$intro_text = apply_filters('display_featured_image_genesis_cpt_description', genesis_get_cpt_option('intro_text'));
if ($intro_text) {
$class = 'archive-description cpt-archive-description';
$this->print_description($intro_text, $class);
}
}
开发者ID:robincornett,项目名称:display-featured-image-genesis,代码行数:30,代码来源:class-displayfeaturedimagegenesis-description.php
示例10: genesis_robots_meta
/**
* Output the `index`, `follow`, `noodp`, `noydir`, `noarchive` robots meta code in the document `head`.
*
* @since 0.1.3
*
* @uses genesis_get_seo_option() Get SEO setting value.
* @uses genesis_get_custom_field() Get custom field value.
*
* @global WP_Query $wp_query Query object.
*
* @return null Return early if blog is not public.
*/
function genesis_robots_meta()
{
global $wp_query;
//* If the blog is private, then following logic is unnecessary as WP will insert noindex and nofollow
if (!get_option('blog_public')) {
return;
}
//* Defaults
$meta = array('noindex' => '', 'nofollow' => '', 'noarchive' => genesis_get_seo_option('noarchive') ? 'noarchive' : '', 'noodp' => genesis_get_seo_option('noodp') ? 'noodp' : '', 'noydir' => genesis_get_seo_option('noydir') ? 'noydir' : '');
//* Check home page SEO settings, set noindex, nofollow and noarchive
if (is_front_page()) {
$meta['noindex'] = genesis_get_seo_option('home_noindex') ? 'noindex' : $meta['noindex'];
$meta['nofollow'] = genesis_get_seo_option('home_nofollow') ? 'nofollow' : $meta['nofollow'];
$meta['noarchive'] = genesis_get_seo_option('home_noarchive') ? 'noarchive' : $meta['noarchive'];
}
if (is_category()) {
$term = $wp_query->get_queried_object();
$meta['noindex'] = $term->meta['noindex'] ? 'noindex' : $meta['noindex'];
$meta['nofollow'] = $term->meta['nofollow'] ? 'nofollow' : $meta['nofollow'];
$meta['noarchive'] = $term->meta['noarchive'] ? 'noarchive' : $meta['noarchive'];
$meta['noindex'] = genesis_get_seo_option('noindex_cat_archive') ? 'noindex' : $meta['noindex'];
$meta['noarchive'] = genesis_get_seo_option('noarchive_cat_archive') ? 'noarchive' : $meta['noarchive'];
//* noindex paged archives, if canonical archives is off
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$meta['noindex'] = $paged > 1 && !genesis_get_seo_option('canonical_archives') ? 'noindex' : $meta['noindex'];
}
if (is_tag()) {
$term = $wp_query->get_queried_object();
$meta['noindex'] = $term->meta['noindex'] ? 'noindex' : $meta['noindex'];
$meta['nofollow'] = $term->meta['nofollow'] ? 'nofollow' : $meta['nofollow'];
$meta['noarchive'] = $term->meta['noarchive'] ? 'noarchive' : $meta['noarchive'];
$meta['noindex'] = genesis_get_seo_option('noindex_tag_archive') ? 'noindex' : $meta['noindex'];
$meta['noarchive'] = genesis_get_seo_option('noarchive_tag_archive') ? 'noarchive' : $meta['noarchive'];
//* noindex paged archives, if canonical archives is off
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$meta['noindex'] = $paged > 1 && !genesis_get_seo_option('canonical_archives') ? 'noindex' : $meta['noindex'];
}
if (is_tax()) {
$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
$meta['noindex'] = $term->meta['noindex'] ? 'noindex' : $meta['noindex'];
$meta['nofollow'] = $term->meta['nofollow'] ? 'nofollow' : $meta['nofollow'];
$meta['noarchive'] = $term->meta['noarchive'] ? 'noarchive' : $meta['noarchive'];
//* noindex paged archives, if canonical archives is off
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$meta['noindex'] = $paged > 1 && !genesis_get_seo_option('canonical_archives') ? 'noindex' : $meta['noindex'];
}
if (is_post_type_archive() && genesis_has_post_type_archive_support()) {
$meta['noindex'] = genesis_get_cpt_option('noindex') ? 'noindex' : $meta['noindex'];
$meta['nofollow'] = genesis_get_cpt_option('nofollow') ? 'nofollow' : $meta['nofollow'];
$meta['noarchive'] = genesis_get_cpt_option('noarchive') ? 'noarchive' : $meta['noarchive'];
//* noindex paged archives, if canonical archives is off
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$meta['noindex'] = $paged > 1 && !genesis_get_seo_option('canonical_archives') ? 'noindex' : $meta['noindex'];
}
if (is_author()) {
$meta['noindex'] = get_the_author_meta('noindex', (int) get_query_var('author')) ? 'noindex' : $meta['noindex'];
$meta['nofollow'] = get_the_author_meta('nofollow', (int) get_query_var('author')) ? 'nofollow' : $meta['nofollow'];
$meta['noarchive'] = get_the_author_meta('noarchive', (int) get_query_var('author')) ? 'noarchive' : $meta['noarchive'];
$meta['noindex'] = genesis_get_seo_option('noindex_author_archive') ? 'noindex' : $meta['noindex'];
$meta['noarchive'] = genesis_get_seo_option('noarchive_author_archive') ? 'noarchive' : $meta['noarchive'];
//* noindex paged archives, if canonical archives is off
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$meta['noindex'] = $paged > 1 && !genesis_get_seo_option('canonical_archives') ? 'noindex' : $meta['noindex'];
}
if (is_date()) {
$meta['noindex'] = genesis_get_seo_option('noindex_date_archive') ? 'noindex' : $meta['noindex'];
$meta['noarchive'] = genesis_get_seo_option('noarchive_date_archive') ? 'noarchive' : $meta['noarchive'];
}
if (is_search()) {
$meta['noindex'] = genesis_get_seo_option('noindex_search_archive') ? 'noindex' : $meta['noindex'];
$meta['noarchive'] = genesis_get_seo_option('noarchive_search_archive') ? 'noarchive' : $meta['noarchive'];
}
if (is_singular()) {
$meta['noindex'] = genesis_get_custom_field('_genesis_noindex') ? 'noindex' : $meta['noindex'];
$meta['nofollow'] = genesis_get_custom_field('_genesis_nofollow') ? 'nofollow' : $meta['nofollow'];
$meta['noarchive'] = genesis_get_custom_field('_genesis_noarchive') ? 'noarchive' : $meta['noarchive'];
}
//* Strip empty array items
$meta = array_filter($meta);
//* Add meta if any exist
if ($meta) {
printf('<meta name="robots" content="%s" />' . "\n", implode(',', $meta));
}
}
开发者ID:treydonovan,项目名称:innergame-anna,代码行数:96,代码来源:header.php
示例11: genesis_get_robots_meta_content
/**
* Determine the `noindex`, `nofollow`, `noodp`, `noydir`, `noarchive` robots meta code for the current context.
*
* @since 2.4.0
*
* @global WP_Query $wp_query Query object.
*
* @return string String for `content` attribute of `robots` meta tag.
*/
function genesis_get_robots_meta_content()
{
global $wp_query;
$post_id = null;
// Defaults.
$directives = array('noindex' => '', 'nofollow' => '', 'noarchive' => genesis_get_seo_option('noarchive') ? 'noarchive' : '', 'noodp' => genesis_get_seo_option('noodp') ? 'noodp' : '', 'noydir' => genesis_get_seo_option('noydir') ? 'noydir' : '');
// Check root page SEO settings, set noindex, nofollow and noarchive.
if (genesis_is_root_page()) {
$directives['noindex'] = genesis_get_seo_option('home_noindex') ? 'noindex' : $directives['noindex'];
$directives['nofollow'] = genesis_get_seo_option('home_nofollow') ? 'nofollow' : $directives['nofollow'];
$directives['noarchive'] = genesis_get_seo_option('home_noarchive') ? 'noarchive' : $directives['noarchive'];
}
// When the page is set as the Posts Page in WordPress core, use the $post_id of the page when loading SEO values.
if (is_home() && get_option('page_for_posts') && get_queried_object_id()) {
$post_id = get_option('page_for_posts');
}
if (is_singular() || null !== $post_id) {
$directives['noindex'] = genesis_get_custom_field('_genesis_noindex', $post_id) ? 'noindex' : $directives['noindex'];
$directives['nofollow'] = genesis_get_custom_field('_genesis_nofollow', $post_id) ? 'nofollow' : $directives['nofollow'];
$directives['noarchive'] = genesis_get_custom_field('_genesis_noarchive', $post_id) ? 'noarchive' : $directives['noarchive'];
} elseif (is_category() || is_tag() || is_tax()) {
$term = $wp_query->get_queried_object();
$directives['noindex'] = get_term_meta($term->term_id, 'noindex', true) ? 'noindex' : $directives['noindex'];
$directives['nofollow'] = get_term_meta($term->term_id, 'nofollow', true) ? 'nofollow' : $directives['nofollow'];
$directives['noarchive'] = get_term_meta($term->term_id, 'noarchive', true) ? 'noarchive' : $directives['noarchive'];
if (is_category()) {
$directives['noindex'] = genesis_get_seo_option('noindex_cat_archive') ? 'noindex' : $directives['noindex'];
$directives['noarchive'] = genesis_get_seo_option('noarchive_cat_archive') ? 'noarchive' : $directives['noarchive'];
} elseif (is_tag()) {
$directives['noindex'] = genesis_get_seo_option('noindex_tag_archive') ? 'noindex' : $directives['noindex'];
$directives['noarchive'] = genesis_get_seo_option('noarchive_tag_archive') ? 'noarchive' : $directives['noarchive'];
}
} elseif (is_post_type_archive() && genesis_has_post_type_archive_support()) {
$directives['noindex'] = genesis_get_cpt_option('noindex') ? 'noindex' : $directives['noindex'];
$directives['nofollow'] = genesis_get_cpt_option('nofollow') ? 'nofollow' : $directives['nofollow'];
$directives['noarchive'] = genesis_get_cpt_option('noarchive') ? 'noarchive' : $directives['noarchive'];
} elseif (is_author()) {
$directives['noindex'] = get_the_author_meta('noindex', (int) get_query_var('author')) ? 'noindex' : $directives['noindex'];
$directives['nofollow'] = get_the_author_meta('nofollow', (int) get_query_var('author')) ? 'nofollow' : $directives['nofollow'];
$directives['noarchive'] = get_the_author_meta('noarchive', (int) get_query_var('author')) ? 'noarchive' : $directives['noarchive'];
$directives['noindex'] = genesis_get_seo_option('noindex_author_archive') ? 'noindex' : $directives['noindex'];
$directives['noarchive'] = genesis_get_seo_option('noarchive_author_archive') ? 'noarchive' : $directives['noarchive'];
} elseif (is_date()) {
$directives['noindex'] = genesis_get_seo_option('noindex_date_archive') ? 'noindex' : $directives['noindex'];
$directives['noarchive'] = genesis_get_seo_option('noarchive_date_archive') ? 'noarchive' : $directives['noarchive'];
} elseif (is_search()) {
$directives['noindex'] = genesis_get_seo_option('noindex_search_archive') ? 'noindex' : $directives['noindex'];
$directives['noarchive'] = genesis_get_seo_option('noarchive_search_archive') ? 'noarchive' : $directives['noarchive'];
}
/**
* Filter the array of directives for the robots meta tag.
*
* @since 2.4.0
*
* @param array $directives May contain keys for `noindex`, `nofollow`, `noodp`, `noydir`, `noarchive`.
*/
$directives = apply_filters('genesis_get_robots_meta_content', $directives);
// Strip empty array items.
$directives = array_filter($directives);
return implode(',', $directives);
}
开发者ID:netmagik,项目名称:netmagik,代码行数:70,代码来源:head.php
示例12: msdlab_do_cpt_archive_title_description
/**
* Add custom headline and description to relevant custom post type archive pages.
*
* If we're not on a post type archive page, or not on page 1, then nothing extra is displayed.
*
* If there's a custom headline to display, it is marked up as a level 1 heading.
*
* If there's a description (intro text) to display, it is run through wpautop() before being added to a div.
*
* @since 2.0.0
*
* @uses genesis_has_post_type_archive_support() Check if a post type should potentially support an archive setting page.
* @uses genesis_get_cpt_option() Get list of custom post types which need an archive settings page.
*
* @return null Return early if not on relevant post type archive.
*/
function msdlab_do_cpt_archive_title_description()
{
if (!is_post_type_archive() || !genesis_has_post_type_archive_support()) {
return;
}
if (get_query_var('paged') >= 2) {
return;
}
$headline = genesis_get_cpt_option('headline');
$intro_text = genesis_get_cpt_option('intro_text');
$headline = $headline ? sprintf('<h1 class="archive-title">%s</h1>', $headline) : '';
$intro_text = $intro_text ? apply_filters('genesis_cpt_archive_intro_text_output', $intro_text) : '';
if ($headline || $intro_text) {
printf('<div class="archive-description cpt-archive-description"><div class="wrap">%s</div></div>', $headline . '<div class="sep"></div>' . $intro_text);
}
}
开发者ID:foxydot,项目名称:daretocare,代码行数:32,代码来源:genesis_tweak_functions.php
示例13: genesis_do_cpt_archive_title_description
/**
* Add custom headline and description to relevant custom post type archive pages.
*
* If we're not on a post type archive page, then nothing extra is displayed.
*
* If there's a custom headline to display, it is marked up as a level 1 heading.
*
* If there's a description (intro text) to display, it is run through wpautop() before being added to a div.
*
* @since 2.0.0
*
* @uses genesis_has_post_type_archive_support() Check if a post type should potentially support an archive setting page.
* @uses genesis_get_cpt_option() Get list of custom post types which need an archive settings page.
*
* @return null Return early if not on relevant post type archive.
*/
function genesis_do_cpt_archive_title_description()
{
if (!is_post_type_archive() || !genesis_has_post_type_archive_support()) {
return;
}
$headline = genesis_get_cpt_option('headline');
if (empty($headline) && genesis_a11y('headings')) {
$headline = post_type_archive_title('', false);
}
$intro_text = genesis_get_cpt_option('intro_text');
$headline = $headline ? sprintf('<h1 %s>%s</h1>', genesis_attr('archive-title'), strip_tags($headline)) : '';
$intro_text = $intro_text ? apply_filters('genesis_cpt_archive_intro_text_output', $intro_text) : '';
if ($headline || $intro_text) {
printf('<div %s>%s</div>', genesis_attr('cpt-archive-description'), $headline . $intro_text);
}
}
开发者ID:Friends-School-Atlanta,项目名称:Deployable-WordPress,代码行数:32,代码来源:archive.php
示例14: set_item_title
protected static function set_item_title($title = '')
{
$frontpage = get_option('show_on_front');
// either 'posts' or 'page'
$postspage = get_option('page_for_posts');
$a11ycheck = current_theme_supports('genesis-accessibility', array('headings'));
if (is_singular()) {
$title = get_the_title();
} elseif (is_home() && 'page' === $frontpage) {
$title = get_post($postspage)->post_title;
} elseif (is_category() || is_tag() || is_tax()) {
$term = is_tax() ? get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')) : get_queried_object();
if (!$term || !isset($term->meta)) {
return;
}
$title = $term->meta['headline'];
if (empty($title) && $a11ycheck) {
$title = $term->name;
}
} elseif (is_author()) {
$title = get_the_author_meta('headline', (int) get_query_var('author'));
if (empty($title) && $a11ycheck) {
$title = get_the_author_meta('display_name', (int) get_query_var('author'));
}
} elseif (is_post_type_archive() && genesis_has_post_type_archive_support()) {
$title = genesis_get_cpt_option('headline');
if (empty($title) && $a11ycheck) {
$title = post_type_archive_title('', false);
}
}
return $title;
}
开发者ID:stevepolitodesign,项目名称:nema-wordpress,代码行数:32,代码来源:class-displayfeaturedimagegenesis-common.php
示例15: genesis_default_title
/**
* Return filtered post title.
*
* This function does 3 things:
* 1. Pulls the values for `$sep` and `$seplocation`, uses defaults if necessary.
* 2. Determines if the site title should be appended.
* 3. Allows the user to set a custom title on a per-page or per-post basis.
*
* @since 0.1.3
*
* @global WP_Query $wp_query Query object.
*
* @param string $title Existing page title.
* @param string $sep Separator character(s). Default is `–` if not set.
* @param string $seplocation Separator location - "left" or "right". Default is "right" if not set.
* @return string Page title, formatted depending on context.
*/
function genesis_default_title($title, $sep, $seplocation)
{
global $wp_query;
$post_id = null;
if (is_feed()) {
return $title;
}
$sep = genesis_get_seo_option('doctitle_sep') ? genesis_get_seo_option('doctitle_sep') : '–';
$seplocation = genesis_get_seo_option('doctitle_seplocation') ? genesis_get_seo_option('doctitle_seplocation') : 'right';
// If viewing the root page.
if (genesis_is_root_page()) {
// Determine the doctitle.
$title = genesis_get_seo_option('home_doctitle') ? genesis_get_seo_option('home_doctitle') : get_bloginfo('name');
// Append site description, if necessary.
$title = genesis_get_seo_option('append_description_home') ? $title . " {$sep} " . get_bloginfo('description') : $title;
}
// When the page is set as the Posts Page in WordPress core, use the $post_id of the page when loading SEO values.
if (is_home() && get_option('page_for_posts') && get_queried_object_id()) {
$post_id = get_option('page_for_posts');
}
// if viewing a post / page / attachment.
if (is_singular() || null !== $post_id) {
// The User Defined Title (Genesis).
if (genesis_get_custom_field('_genesis_title', $post_id)) {
$title = genesis_get_custom_field('_genesis_title', $post_id);
} elseif (genesis_get_custom_field('_aioseop_title', $post_id)) {
$title = genesis_get_custom_field('_aioseop_title', $post_id);
} elseif (genesis_get_custom_field('_headspace_page_title', $post_id)) {
$title = genesis_get_custom_field('_headspace_page_title', $post_id);
} elseif (genesis_get_custom_field('thesis_title', $post_id)) {
$title = genesis_get_custom_field('thesis_title', $post_id);
} elseif (genesis_get_custom_field('title_tag', $post_id)) {
$title = genesis_get_custom_field('title_tag', $post_id);
} elseif (genesis_get_custom_field('title', $post_id)) {
$title = genesis_get_custom_field('title', $post_id);
}
}
if (is_category() || is_tag() || is_tax()) {
$term = get_queried_object();
$title_meta = get_term_meta($term->term_id, 'doctitle', true);
$title = !empty($title_meta) ? $title_meta : $title;
}
if (is_author()) {
$user_title = get_the_author_meta('doctitle', (int) get_query_var('author'));
$title = $user_title ? $user_title : $title;
}
if (is_post_type_archive() && genesis_has_post_type_archive_support()) {
$title = genesis_get_cpt_option('doctitle') ? genesis_get_cpt_option('doctitle') : $title;
}
// If we don't want site name appended, or if we're on the home page.
if (!genesis_get_seo_option('append_site_title') || is_front_page()) {
return esc_html(trim($title));
}
// Else append the site name.
$title = 'right' === $seplocation ? $title . " {$sep} " . get_bloginfo('name') : get_bloginfo('name') . " {$sep} " . $title;
return esc_html(trim($title));
}
开发者ID:netmagik,项目名称:netmagik,代码行数:74,代码来源:header.php
注:本文中的genesis_has_post_type_archive_support函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论