当前位置: 首页>>代码示例>>PHP>>正文


PHP amt_get_language_content函数代码示例

本文整理汇总了PHP中amt_get_language_content函数的典型用法代码示例。如果您正苦于以下问题:PHP amt_get_language_content函数的具体用法?PHP amt_get_language_content怎么用?PHP amt_get_language_content使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了amt_get_language_content函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: amt_add_jsonld_schemaorg_metadata_head


//.........这里部分代码省略.........
        if ($options['author_profile_source'] != 'frontpage' || !amt_has_page_on_front()) {
            // Publisher
            // Scope BEGIN: Organization: http://schema.org/Organization
            //        $metadata_arr[] = '<!-- Scope BEGIN: Organization -->';
            //        $metadata_arr[] = '<span itemprop="publisher" itemscope itemtype="http://schema.org/Organization"' . amt_get_schemaorg_itemref('organization') . '>';
            // Get publisher metatags
            //        $metadata_arr = array_merge( $metadata_arr, amt_get_schemaorg_publisher_metatags( $options, $post->post_author ) );
            $metadata_arr['publisher'] = amt_get_jsonld_schemaorg_publisher_array($options, $post->post_author);
            // Scope END: Organization
            //        $metadata_arr[] = '</span> <!-- Scope END: Organization -->';
        }
        // Author
        // Scope BEGIN: Person: http://schema.org/Person
        //        $metadata_arr[] = '<!-- Scope BEGIN: Person -->';
        //        $metadata_arr[] = '<span itemprop="author" itemscope itemtype="http://schema.org/Person"' . amt_get_schemaorg_itemref('person_author') . '>';
        // Get author metatags
        $metadata_arr['author'] = amt_get_jsonld_schemaorg_author_array($post->post_author, $options);
        // Scope END: Person
        //        $metadata_arr[] = '</span> <!-- Scope END: Person -->';
        // name
        $metadata_arr['name'] = esc_attr(strip_tags(get_the_title($post->ID)));
        // headline - contains title information
        $metadata_arr['headline'] = esc_attr(amt_get_title_for_metadata($options, $post));
        // Description - We use the description defined by Add-Meta-Tags
        $content_desc = amt_get_content_description($post);
        if (!empty($content_desc)) {
            $metadata_arr['description'] = esc_attr($content_desc);
        }
        // Dates
        $metadata_arr['datePublished'] = esc_attr(amt_iso8601_date($post->post_date));
        $metadata_arr['dateModified'] = esc_attr(amt_iso8601_date($post->post_modified));
        $metadata_arr['copyrightYear'] = esc_attr(mysql2date('Y', $post->post_date));
        // Language
        $metadata_arr['inLanguage'] = esc_attr(str_replace('-', '_', amt_get_language_content($options, $post)));
        // Thumbnail
        // A featured image is supported by video and audio attachments.
        // If one is set, then it is set as the thumbnail of the video/audio object.
        if ('video' == $attachment_type || 'audio' == $attachment_type) {
            if (function_exists('has_post_thumbnail') && has_post_thumbnail($post->ID)) {
                // Thumbnail URL of the featured image
                $image_size = apply_filters('amt_image_size_attachment', 'full');
                $thumbnail_info = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), $image_size);
                $metadata_arr['thumbnailUrl'] = esc_url_raw($thumbnail_info[0]);
                // Currently we do not add a full ImageObject for the attachment's featured image.
                // TODO: future
            }
        }
        // mainEntityOfPage
        $metadata_arr['mainEntityOfPage'] = esc_url(get_permalink($post->ID));
        // Metadata specific to each attachment type
        if ('image' == $attachment_type) {
            // Allow filtering of the image size.
            $image_size = apply_filters('amt_image_size_attachment', 'full');
            // Get image metatags. $post is an image object.
            $metadata_arr = array_merge($metadata_arr, amt_get_jsonld_schemaorg_image_array($options, $post, $size = $image_size, $is_representative = true));
            // Add the post body here
            //            $metadata_arr[] = $post_body;
            // Scope END: ImageObject
            //            $metadata_arr[] = '</div> <!-- Scope END: ImageObject -->';
        } elseif ('video' == $attachment_type) {
            // Video specific metatags
            // URL (links to image file)
            //$metadata_arr['url'] = esc_url_raw( get_permalink( $post->ID ) );
            $metadata_arr['url'] = esc_url_raw(wp_get_attachment_url($post->ID));
            // sameAs (links to attachment page)
            $metadata_arr['sameAs'] = esc_url_raw(get_permalink($post->ID));
开发者ID:ashenkar,项目名称:sanga,代码行数:67,代码来源:amt_schemaorg.php

示例2: amt_add_basic_metadata_head

/**
 * Generates basic metadata for the head area.
 *
 */
function amt_add_basic_metadata_head($post, $attachments, $embedded_media, $options)
{
    $do_description = $options["auto_description"] == "1" ? true : false;
    $do_keywords = $options["auto_keywords"] == "1" ? true : false;
    $do_noodp_description = $options["noodp_description"] == "1" ? true : false;
    // Array to store metadata
    $metadata_arr = array();
    // Robots Meta Tag.
    $robots_content = '';
    if ($do_noodp_description && (is_front_page() || is_singular())) {
        // Add NOODP on posts and pages
        $robots_content = 'NOODP,NOYDIR';
        // Allow filtering of the robots meta tag content.
        $robots_content = apply_filters('amt_robots_data', $robots_content);
    }
    // Add a robots meta tag if its content is not empty.
    if (!empty($robots_content)) {
        $metadata_arr[] = '<meta name="robots" content="' . $robots_content . '" />';
    }
    // hreflang link element
    if ($options['generate_hreflang_links'] == '1') {
        if (is_singular()) {
            $locale = amt_get_language_content($options, $post);
            $hreflang = amt_get_the_hreflang($locale, $options);
            $hreflang_url = amt_get_permalink_for_multipage($post);
        } else {
            $locale = amt_get_language_site($options);
            $hreflang = amt_get_the_hreflang($locale, $options);
            $hreflang_url = '';
            if (amt_is_default_front_page()) {
                $hreflang_url = trailingslashit(get_bloginfo('url'));
            } elseif (is_category() || is_tag() || is_tax()) {
                // $post is a term object
                $hreflang_url = get_term_link($post);
            } elseif (is_author()) {
                // $post is an author object
                $hreflang_url = get_author_posts_url($post->ID);
            } elseif (is_year()) {
                $archive_year = get_the_time('Y');
                $hreflang_url = get_year_link($archive_year);
            } elseif (is_month()) {
                $archive_year = get_the_time('Y');
                $archive_month = get_the_time('m');
                $hreflang_url = get_month_link($archive_year, $archive_month);
            } elseif (is_day()) {
                $archive_year = get_the_time('Y');
                $archive_month = get_the_time('m');
                $archive_day = get_the_time('d');
                $hreflang_url = get_day_link($archive_year, $archive_month, $archive_day);
            }
            // If paged information is available
            if (is_paged()) {
                //$hreflang_url = trailingslashit( $hreflang_url ) . get_query_var('paged') . '/';
                $hreflang_url = get_pagenum_link(get_query_var('paged'));
            }
        }
        // hreflang links array
        $hreflang_arr = array();
        // Add link element
        if (!empty($hreflang) && !empty($hreflang_url)) {
            $hreflang_arr[] = '<link rel="alternate" hreflang="' . esc_attr($hreflang) . '" href="' . esc_url_raw($hreflang_url) . '" />';
        }
        // Allow filtering of the hreflang array
        $hreflang_arr = apply_filters('amt_hreflang_links', $hreflang_arr, $hreflang, $hreflang_url);
        // Add to to metadata array
        foreach ($hreflang_arr as $hreflang_link) {
            $metadata_arr[] = $hreflang_link;
        }
    }
    // Basic Meta Tags
    // Default front page displaying latest posts
    if (amt_is_default_front_page()) {
        // Description and Keywords from the Add-Meta-Tags settings override
        // default behaviour.
        // Description
        if ($do_description) {
            // Use the site description from the Add-Meta-Tags settings.
            // Fall back to the blog description.
            $site_description = amt_get_site_description($options);
            if (empty($site_description)) {
                // Alternatively, use the blog description
                // Here we sanitize the provided description for safety
                $site_description = sanitize_text_field(amt_sanitize_description(get_bloginfo('description')));
            }
            // If we have a description, use it in the description meta-tag of the front page
            if (!empty($site_description)) {
                // Note: Contains multipage information through amt_process_paged()
                $metadata_arr[] = '<meta name="description" content="' . esc_attr(amt_process_paged($site_description)) . '" />';
            }
        }
        // Keywords
        if ($do_keywords) {
            // Use the site keywords from the Add-Meta-Tags settings.
            // Fall back to the blog categories.
            $site_keywords = amt_get_site_keywords($options);
            if (empty($site_keywords)) {
//.........这里部分代码省略.........
开发者ID:RomualdKarbido,项目名称:Zeroom,代码行数:101,代码来源:amt_basic.php

示例3: amt_add_opengraph_metadata_head


//.........这里部分代码省略.........
                $metadata_arr = array_merge($metadata_arr, $image_meta_tags);
            }
        }
        // Front page using a static page
        // Note: might also contain a listing of posts which may be paged, so use amt_process_paged()
    } elseif (amt_is_static_front_page()) {
        // Type
        if ($options['author_profile_source'] == 'frontpage') {
            // The front page is treated as the profile page.
            $metadata_arr[] = '<meta property="og:type" content="profile" />';
        } else {
            $metadata_arr[] = '<meta property="og:type" content="website" />';
        }
        // Site Name
        $metadata_arr[] = '<meta property="og:site_name" content="' . esc_attr(get_bloginfo('name')) . '" />';
        // Title - Note: Contains multipage information
        $metadata_arr['og:title'] = '<meta property="og:title" content="' . esc_attr(amt_get_title_for_metadata($options, $post)) . '" />';
        // URL - Note: different method to get the permalink on paged archives
        if (is_paged()) {
            $metadata_arr[] = '<meta property="og:url" content="' . esc_url_raw(get_pagenum_link(get_query_var('paged'))) . '" />';
        } else {
            $metadata_arr[] = '<meta property="og:url" content="' . esc_url_raw(trailingslashit(get_bloginfo('url'))) . '" />';
        }
        // Site Description - Note: Contains multipage information through amt_process_paged()
        $content_desc = amt_get_content_description($post);
        if (!empty($content_desc)) {
            // Use the pages custom description
            $metadata_arr[] = '<meta property="og:description" content="' . esc_attr(amt_process_paged($content_desc)) . '" />';
        } elseif (get_bloginfo('description')) {
            // Alternatively use the blog's description
            $metadata_arr[] = '<meta property="og:description" content="' . esc_attr(amt_process_paged(get_bloginfo('description'))) . '" />';
        }
        // Locale
        $metadata_arr[] = '<meta property="og:locale" content="' . esc_attr(str_replace('-', '_', amt_get_language_content($options, $post))) . '" />';
        // Site Image
        // First check if a global image override URL has been entered.
        // If yes, use this image URL and override all other images.
        $image_data = amt_get_image_attributes_array(amt_get_post_meta_image_url($post->ID));
        if (!empty($image_data)) {
            $image_size = apply_filters('amt_image_size_index', 'full');
            $image_meta_tags = amt_get_opengraph_image_metatags($options, $image_data, $size = $image_size);
            if (!empty($image_meta_tags)) {
                $metadata_arr = array_merge($metadata_arr, $image_meta_tags);
            }
            //$global_image_override_url = amt_get_post_meta_image_url($post->ID);
            //if ( ! empty( $global_image_override_url ) ) {
            //    $metadata_arr[] = '<meta property="og:image" content="' . esc_url_raw( $global_image_override_url ) . '" />';
            //    if ( is_ssl() || ( ! is_ssl() && $options["has_https_access"] == "1" ) ) {
            //        $metadata_arr[] = '<meta property="og:image:secure_url" content="' . esc_url_raw( str_replace('http:', 'https:', $global_image_override_url ) ) . '" />';
            //    }
            // Then try the featured image, if exists.
        } elseif (function_exists('has_post_thumbnail') && has_post_thumbnail($post->ID)) {
            // Allow filtering of the image size.
            $image_size = apply_filters('amt_image_size_index', 'full');
            $metadata_arr = array_merge($metadata_arr, amt_get_opengraph_image_metatags($options, get_post_thumbnail_id($post->ID), $size = $image_size));
        } else {
            // Use the default image, if one has been set.
            $image_data = amt_get_default_image_data();
            if (!empty($image_data)) {
                $image_size = apply_filters('amt_image_size_index', 'full');
                $image_meta_tags = amt_get_opengraph_image_metatags($options, $image_data, $size = $image_size);
                if (!empty($image_meta_tags)) {
                    $metadata_arr = array_merge($metadata_arr, $image_meta_tags);
                }
            }
            // Alternatively, use default image
开发者ID:pytong,项目名称:research-group,代码行数:67,代码来源:amt_opengraph.php

示例4: amt_add_basic_metadata_head


//.........这里部分代码省略.........
        }
    }
    // Add robot_options filtering
    $robots_options = apply_filters('amt_robots_options', $robots_options);
    if (version_compare(PHP_VERSION, '5.3', '<')) {
        // The flag is not supported
        $robots_options = array_unique($robots_options);
    } else {
        $robots_options = array_unique($robots_options, SORT_STRING);
    }
    if (!empty($robots_options)) {
        $metadata_arr['basic:robots'] = '<meta name="robots" content="' . esc_attr(implode(',', $robots_options)) . '" />';
    }
    // Add full meta tags
    // Merge meta tags
    $processed_full_meta_tags = apply_filters('amt_full_metatags_processed', $processed_full_meta_tags);
    if (!empty($processed_full_meta_tags)) {
        $metadata_arr = array_merge($metadata_arr, $processed_full_meta_tags);
    }
    // Add copyright link
    // On every page print the copyright head link
    $copyright_url = amt_get_site_copyright_url($options);
    //if ( empty($copyright_url)) {
    //    $copyright_url = trailingslashit( get_bloginfo('url') );
    //}
    if (!empty($copyright_url)) {
        $metadata_arr['basic:copyright'] = '<link rel="copyright" type="text/html" title="' . esc_attr(get_bloginfo('name')) . ' ' . __('copyright information', 'add-meta-tags') . '" href="' . esc_url($copyright_url) . '" />';
    }
    // hreflang link element
    // This section also expects an array of extra hreflang links that may have
    // been collected from the full meta tags boxes.
    if ($options['generate_hreflang_links'] == '1') {
        if (is_singular()) {
            $locale = amt_get_language_content($options, $post);
            $hreflang = amt_get_the_hreflang($locale, $options);
            $hreflang_url = amt_get_permalink_for_multipage($post);
        } else {
            $locale = amt_get_language_site($options);
            $hreflang = amt_get_the_hreflang($locale, $options);
            $hreflang_url = '';
            if (amt_is_default_front_page()) {
                $hreflang_url = trailingslashit(get_bloginfo('url'));
            } elseif (is_category() || is_tag() || is_tax()) {
                // $post is a term object
                $hreflang_url = get_term_link($post);
            } elseif (is_author()) {
                // $post is an author object
                $hreflang_url = get_author_posts_url($post->ID);
            } elseif (is_year()) {
                $archive_year = get_the_time('Y');
                $hreflang_url = get_year_link($archive_year);
            } elseif (is_month()) {
                $archive_year = get_the_time('Y');
                $archive_month = get_the_time('m');
                $hreflang_url = get_month_link($archive_year, $archive_month);
            } elseif (is_day()) {
                $archive_year = get_the_time('Y');
                $archive_month = get_the_time('m');
                $archive_day = get_the_time('d');
                $hreflang_url = get_day_link($archive_year, $archive_month, $archive_day);
            }
            // If paged information is available
            if (is_paged()) {
                //$hreflang_url = trailingslashit( $hreflang_url ) . get_query_var('paged') . '/';
                $hreflang_url = get_pagenum_link(get_query_var('paged'));
            }
开发者ID:ashenkar,项目名称:sanga,代码行数:67,代码来源:amt_basic.php

示例5: amt_set_html_lang_attribute

/**
 * Sets the correct lang attribute of the html element of the page,
 * according to the content's locale.
 */
function amt_set_html_lang_attribute($lang)
{
    //var_dump($lang);
    $options = get_option('add_meta_tags_opts');
    if (!is_array($options)) {
        return $lang;
    } elseif (!array_key_exists('manage_html_lang_attribute', $options)) {
        return $lang;
    } elseif ($options['manage_html_lang_attribute'] == '0') {
        return $lang;
    }
    // Set the html lang attribute according to the locale
    $locale = '';
    if (is_singular()) {
        $post = get_queried_object();
        $locale = str_replace('_', '-', amt_get_language_content($options, $post));
    } else {
        $locale = str_replace('_', '-', amt_get_language_site($options));
    }
    // Allow filtering
    $locale = apply_filters('amt_wordpress_lang', $locale);
    if (!empty($locale)) {
        // Replace WordPress locale with ours. (even if it's the same)
        $lang = str_replace(get_bloginfo('language'), $locale, $lang);
    }
    return $lang;
}
开发者ID:simonsays88,项目名称:costa,代码行数:31,代码来源:add-meta-tags.php

示例6: amt_add_dublin_core_metadata_head

function amt_add_dublin_core_metadata_head($post, $attachments, $embedded_media, $options)
{
    if (apply_filters('amt_exclude_dublin_core_metadata', false)) {
        return array();
    }
    $metadata_arr = array();
    $do_auto_dublincore = $options["auto_dublincore"] == "1" ? true : false;
    if (!$do_auto_dublincore) {
        return $metadata_arr;
    }
    // Custom content override
    if (amt_is_custom($post, $options)) {
        // Return metadata with:
        // add_filter( 'amt_custom_metadata_dublin_core', 'my_function', 10, 5 );
        // Return an array of meta tags. Array item format: ['key_can_be_whatever'] = '<meta name="foo" content="bar" />'
        $metadata_arr = apply_filters('amt_custom_metadata_dublin_core', $metadata_arr, $post, $options, $attachments, $embedded_media);
        return $metadata_arr;
    }
    if (!is_singular() || is_front_page()) {
        // is_front_page() is used for the case in which a static page is used as the front page.
        // Dublin Core metadata has a meaning for content only.
        return array();
    }
    // The Dublin Core metadata generator does not support products or product groups.
    if (amt_is_product() || amt_is_product_group()) {
        return array();
    }
    // Title
    // Note: Contains multipage information through amt_process_paged()
    $metadata_arr['dcterms.title'] = '<meta name="dcterms.title" content="' . esc_attr(amt_get_title_for_metadata($options, $post)) . '" />';
    // Resource identifier - Uses amt_get_permalink_for_multipage()
    $metadata_arr[] = '<meta name="dcterms.identifier" content="' . esc_url_raw(amt_get_permalink_for_multipage($post)) . '" />';
    $metadata_arr[] = '<meta name="dcterms.creator" content="' . esc_attr(amt_get_dublin_core_author_notation($post)) . '" />';
    //$metadata_arr[] = '<meta name="dcterms.date" content="' . esc_attr( amt_iso8601_date($post->post_date) ) . '" />';
    $metadata_arr[] = '<meta name="dcterms.created" content="' . esc_attr(amt_iso8601_date($post->post_date)) . '" />';
    $metadata_arr[] = '<meta name="dcterms.available" content="' . esc_attr(amt_iso8601_date($post->post_date)) . '" />';
    //$metadata_arr[] = '<meta name="dcterms.issued" content="' . esc_attr( amt_iso8601_date($post->post_date) ) . '" />';
    $metadata_arr[] = '<meta name="dcterms.modified" content="' . esc_attr(amt_iso8601_date($post->post_modified)) . '" />';
    // Description
    // We use the same description as the ``description`` meta tag.
    // Note: Contains multipage information through amt_process_paged()
    $content_desc = amt_get_content_description($post);
    if (!empty($content_desc)) {
        $metadata_arr[] = '<meta name="dcterms.description" content="' . esc_attr(amt_process_paged($content_desc)) . '" />';
    }
    // Keywords
    if (!is_attachment()) {
        // Attachments do not support keywords
        // dcterms.subject - one for each keyword.
        $keywords = explode(',', amt_get_content_keywords($post));
        foreach ($keywords as $subject) {
            $subject = trim($subject);
            if (!empty($subject)) {
                $metadata_arr[] = '<meta name="dcterms.subject" content="' . esc_attr($subject) . '" />';
            }
        }
    }
    $metadata_arr[] = '<meta name="dcterms.language" content="' . esc_attr(amt_get_language_content($options, $post)) . '" />';
    $metadata_arr[] = '<meta name="dcterms.publisher" content="' . esc_url_raw(trailingslashit(get_bloginfo('url'))) . '" />';
    // Copyright page
    $copyright_url = amt_get_site_copyright_url($options);
    if (empty($copyright_url)) {
        $copyright_url = trailingslashit(get_bloginfo('url'));
    }
    if (!empty($copyright_url)) {
        $metadata_arr[] = '<meta name="dcterms.rights" content="' . esc_url_raw($copyright_url) . '" />';
    }
    // License
    $license_url = '';
    // The following requires creative commons configurator
    if (function_exists('bccl_get_license_url')) {
        $license_url = bccl_get_license_url();
    }
    // Allow filtering of the license URL
    $license_url = apply_filters('amt_dublin_core_license', $license_url, $post->ID);
    // Add metatag if $license_url is not empty.
    if (!empty($license_url)) {
        $metadata_arr[] = '<meta name="dcterms.license" content="' . esc_url_raw($license_url) . '" />';
    }
    // Coverage
    $metadata_arr[] = '<meta name="dcterms.coverage" content="World" />';
    if (is_attachment()) {
        $mime_type = get_post_mime_type($post->ID);
        //$attachment_type = strstr( $mime_type, '/', true );
        // See why we do not use strstr(): http://www.codetrax.org/issues/1091
        $attachment_type = preg_replace('#\\/[^\\/]*$#', '', $mime_type);
        $metadata_arr[] = '<meta name="dcterms.isPartOf" content="' . esc_url_raw(get_permalink($post->post_parent)) . '" />';
        if ('image' == $attachment_type) {
            $metadata_arr[] = '<meta name="dcterms.type" content="Image" />';
            $metadata_arr[] = '<meta name="dcterms.format" content="' . $mime_type . '" />';
        } elseif ('video' == $attachment_type) {
            $metadata_arr[] = '<meta name="dcterms.type" content="MovingImage" />';
            $metadata_arr[] = '<meta name="dcterms.format" content="' . $mime_type . '" />';
        } elseif ('audio' == $attachment_type) {
            $metadata_arr[] = '<meta name="dcterms.type" content="Sound" />';
            $metadata_arr[] = '<meta name="dcterms.format" content="' . $mime_type . '" />';
        }
        // Finally add the hasFormat
        $metadata_arr[] = '<meta name="dcterms.hasFormat" content="' . esc_url_raw(wp_get_attachment_url($post->ID)) . '" />';
    } else {
//.........这里部分代码省略.........
开发者ID:pytong,项目名称:research-group,代码行数:101,代码来源:amt_dublin_core.php

示例7: amt_add_schemaorg_metadata_content_filter


//.........这里部分代码省略.........
            $itemref = apply_filters('amt_schemaorg_itemref_attachment_audio', '');
            if (!empty($itemref)) {
                $itemref_attrib = ' itemref="' . $itemref . '"';
            } else {
                $itemref_attrib = '';
            }
            $metadata_arr[] = '<div itemscope itemtype="http://schema.org/AudioObject"' . $itemref_attrib . '>';
        } else {
            // we do not currently support other attachment types, so we stop processing here
            return $post_body;
        }
        // Metadata commong to all attachments
        // Publisher
        // Scope BEGIN: Organization: http://schema.org/Organization
        $metadata_arr[] = '<!-- Scope BEGIN: Organization -->';
        $metadata_arr[] = '<span itemprop="publisher" itemscope itemtype="http://schema.org/Organization">';
        // Get publisher metatags
        $metadata_arr = array_merge($metadata_arr, amt_get_schemaorg_publisher_metatags($options, $post->post_author));
        // Scope END: Organization
        $metadata_arr[] = '</span> <!-- Scope END: Organization -->';
        // Author
        // Scope BEGIN: Person: http://schema.org/Person
        $metadata_arr[] = '<!-- Scope BEGIN: Person -->';
        $metadata_arr[] = '<span itemprop="author" itemscope itemtype="http://schema.org/Person">';
        // Get author metatags
        $metadata_arr = array_merge($metadata_arr, amt_get_schemaorg_author_metatags($post->post_author));
        // Scope END: Person
        $metadata_arr[] = '</span> <!-- Scope END: Person -->';
        // Dates
        $metadata_arr[] = '<meta itemprop="datePublished" content="' . esc_attr(amt_iso8601_date($post->post_date)) . '" />';
        $metadata_arr[] = '<meta itemprop="dateModified" content="' . esc_attr(amt_iso8601_date($post->post_modified)) . '" />';
        $metadata_arr[] = '<meta itemprop="copyrightYear" content="' . esc_attr(mysql2date('Y', $post->post_date)) . '" />';
        // Language
        $metadata_arr[] = '<meta itemprop="inLanguage" content="' . esc_attr(str_replace('-', '_', amt_get_language_content($options))) . '" />';
        // Metadata specific to each attachment type
        if ('image' == $attachment_type) {
            // Allow filtering of the image size.
            $image_size = apply_filters('amt_image_size_attachment', 'full');
            // Get image metatags. $post is an image object.
            $metadata_arr = array_merge($metadata_arr, amt_get_schemaorg_image_metatags($post, $size = $image_size, $is_representative = true));
            // Add the post body here
            $metadata_arr[] = $post_body;
            // Scope END: ImageObject
            $metadata_arr[] = '</div> <!-- Scope END: ImageObject -->';
        } elseif ('video' == $attachment_type) {
            // Video specific metatags
            // URL (for attachments: links to attachment page)
            $metadata_arr[] = '<meta itemprop="url" content="' . esc_url_raw(get_permalink($post->ID)) . '" />';
            $metadata_arr[] = '<meta itemprop="contentUrl" content="' . esc_url_raw(wp_get_attachment_url($post->ID)) . '" />';
            $metadata_arr[] = '<meta itemprop="encodingFormat" content="' . esc_attr($mime_type) . '" />';
            // Add the post body here
            $metadata_arr[] = $post_body;
            // Scope END: VideoObject
            $metadata_arr[] = '</div> <!-- Scope END: VideoObject -->';
        } elseif ('audio' == $attachment_type) {
            // Audio specific metatags
            // URL (for attachments: links to attachment page)
            $metadata_arr[] = '<meta itemprop="url" content="' . esc_url_raw(get_permalink($post->ID)) . '" />';
            $metadata_arr[] = '<meta itemprop="contentUrl" content="' . esc_url_raw(wp_get_attachment_url($post->ID)) . '" />';
            $metadata_arr[] = '<meta itemprop="encodingFormat" content="' . esc_attr($mime_type) . '" />';
            // Add the post body here
            $metadata_arr[] = $post_body;
            // Scope END: AudioObject
            $metadata_arr[] = '</div> <!-- Scope END: AudioObject -->';
        }
        // Content
开发者ID:rpi-virtuell,项目名称:wordpress-add-meta-tags,代码行数:67,代码来源:amt_schemaorg.php


注:本文中的amt_get_language_content函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。