コード例 #1
0
ファイル: entries.php プロジェクト: mastinoz/Momtaz-Framework
/**
 * Display the post class attribute.
 *
 * @param string|array $class One or more classes to add to the class list.
 * @param int $post_id An optional post ID.
 * @since 1.1
 */
function momtaz_post_class($class = '', $post_id = 0)
{
    // Get post classes array.
    $classes = momtaz_get_post_class($class, $post_id);
    // Display the `class` attribute.
    momtaz_html_atts(array('class' => $classes));
}
コード例 #2
0
ファイル: markup.php プロジェクト: mastinoz/Momtaz-Framework
/**
 * Add attributes for the entry element.
 *
 * @return array
 * @since 1.3
 */
function momtaz_atts_entry($atts)
{
    $post = get_post();
    if (empty($post)) {
        return $atts;
    }
    $post_id = get_the_ID();
    $atts['id'] = "post-{$post_id}";
    if (!isset($atts['class'])) {
        $atts['class'] = momtaz_get_post_class();
    } else {
        $atts['class'] = momtaz_get_post_class($atts['class']);
    }
    // HTML5 Microdata
    $atts['itemscope'] = 'itemscope';
    // Blog posts microdata
    if ('post' === $post->post_type) {
        $atts['itemtype'] = 'http://schema.org/BlogPosting';
        if (momtaz_is_the_single($post_id)) {
            $atts['itemprop'] = 'blogPost';
        }
    } elseif ('attachment' === $post->post_type) {
        if (wp_attachment_is_image($post_id)) {
            $atts['itemtype'] = 'http://schema.org/ImageObject';
        }
    } else {
        $atts['itemtype'] = 'http://schema.org/CreativeWork';
    }
    return $atts;
}