コード例 #1
0
ファイル: core.php プロジェクト: un1coin/ovn-space
 function wm_schema_org($element = '', $output_meta_tag = false)
 {
     //Requirements check
     if (function_exists('wma_schema_org')) {
         return wma_schema_org($element, $output_meta_tag);
     }
     if (!$element || !apply_filters('wmhook_wm_schema_org_enable', true)) {
         return;
     }
     //Helper variables
     $output = apply_filters('wmhook_schema_org_output_pre', '', $element, $output_meta_tag);
     if ($output) {
         return apply_filters('wmhook_wm_schema_org_output', ' ' . $output, $element, $output_meta_tag);
     }
     $base = apply_filters('wmhook_wm_schema_org_base', 'http://schema.org/', $element, $output_meta_tag);
     $post_id = is_home() ? get_option('page_for_posts') : null;
     $type = get_post_meta($post_id, 'schemaorg_type', true);
     //Add custom post types that describe a single item to this array
     $itempage_array = (array) apply_filters('wmhook_schema_org_itempage_array', array('jetpack-portfolio'), $element, $output_meta_tag);
     //Generate output
     switch ($element) {
         case 'author':
             $output = 'itemprop="author"';
             break;
         case 'datePublished':
             $output = 'itemprop="datePublished"';
             break;
         case 'entry':
             $output = 'itemscope ';
             if (is_page()) {
                 $output .= 'itemtype="' . $base . 'WebPage"';
             } elseif (is_singular('jetpack-portfolio')) {
                 $output .= 'itemprop="workExample" itemtype="' . $base . 'CreativeWork"';
             } elseif ('audio' === get_post_format()) {
                 $output .= 'itemtype="' . $base . 'AudioObject"';
             } elseif ('gallery' === get_post_format()) {
                 $output .= 'itemprop="ImageGallery" itemtype="' . $base . 'ImageGallery"';
             } elseif ('video' === get_post_format()) {
                 $output .= 'itemprop="video" itemtype="' . $base . 'VideoObject"';
             } else {
                 $output .= 'itemprop="blogPost" itemtype="' . $base . 'BlogPosting"';
             }
             break;
         case 'entry_body':
             if (!is_single()) {
                 $output = 'itemprop="description"';
             } elseif (is_page()) {
                 $output = 'itemprop="mainContentOfPage"';
             } else {
                 $output = 'itemprop="articleBody"';
             }
             break;
         case 'image':
             $output = 'itemprop="image"';
             break;
         case 'ItemList':
             $output = 'itemscope itemtype="' . $base . 'ItemList"';
             break;
         case 'keywords':
             $output = 'itemprop="keywords"';
             break;
         case 'name':
             $output = 'itemprop="name"';
             break;
         case 'Person':
             $output = 'itemscope itemtype="' . $base . 'Person"';
             break;
         case 'SiteNavigationElement':
             $output = 'itemscope itemtype="' . $base . 'SiteNavigationElement"';
             break;
         case 'url':
             $output = 'itemprop="url"';
             break;
         case 'WPFooter':
             $output = 'itemscope itemtype="' . $base . 'WPFooter"';
             break;
         case 'WPSideBar':
             $output = 'itemscope itemtype="' . $base . 'WPSideBar"';
             break;
         case 'WPHeader':
             $output = 'itemscope itemtype="' . $base . 'WPHeader"';
             break;
         default:
             $output = $element;
             break;
     }
     $output = ' ' . $output;
     //Output in <meta> tag
     if ($output_meta_tag) {
         if (false === strpos($output, 'content=')) {
             $output .= ' content="true"';
         }
         $output = '<meta ' . trim($output) . ' />';
     }
     //Output
     return apply_filters('wmhook_wm_schema_org_output', $output, $element, $output_meta_tag);
 }
コード例 #2
0
<article class="<?php 
echo $helper['item_class'];
?>
"<?php 
echo wma_schema_org('article');
?>
>

	<?php 
if (has_post_thumbnail($helper['post_id'])) {
    ?>
		<div class="wm-posts-element wm-html-element image image-container"<?php 
    echo wma_schema_org('image');
    ?>
>
			<?php 
    if ($helper['link']) {
        echo '<a' . $helper['link'] . wma_schema_org('bookmark') . '>';
    }
    the_post_thumbnail($helper['image_size'], array('title' => esc_attr(get_the_title(get_post_thumbnail_id($helper['post_id'])))));
    if ($helper['link']) {
        echo '</a>';
    }
    ?>
		</div>
	<?php 
}
?>

</article>
コード例 #3
0
ファイル: w-contact.php プロジェクト: pab44/pab44
 /**
  * Widget HTML
  *
  * @since    1.0.9.9
  * @version  1.2.3
  */
 function widget($args, $instance)
 {
     // Helper variables
     $output = '';
     $address = array();
     $heading_tag = intval(preg_replace('/[^0-9]+/', '', $args['after_title'])) + 1;
     $heading_atts = ' class="screen-reader-text"';
     if (2 > $heading_tag || 6 < $heading_tag) {
         $heading_tag = 6;
     }
     $heading_tag = 'h' . $heading_tag;
     $instance = wp_parse_args($instance, array('address' => '', 'email' => '', 'hours' => '', 'name' => '', 'phone' => '', 'title' => ''));
     // Processing
     if (trim($instance['title'])) {
         $output .= $args['before_title'] . apply_filters('widget_title', $instance['title'], $instance, $this->id_base, $args) . $args['after_title'];
     }
     // Address
     if (trim($instance['name']) || trim($instance['address'])) {
         $address[10] = '<div class="address contact-info"' . wma_schema_org('itemprop="address"') . '>' . '<' . tag_escape($heading_tag) . $heading_atts . '>' . esc_html__('Address:', 'webman-amplifier') . '</' . tag_escape($heading_tag) . '>' . '<strong' . wma_schema_org('itemprop="name"') . '>' . $instance['name'] . '</strong><br />' . str_replace("\r\n", '<br />', $instance['address']) . '</div>';
     }
     // Business hours
     if (trim($instance['hours'])) {
         $instance['hours'] = trim($instance['hours']);
         if (false === strpos($instance['hours'], ',')) {
             $instance['hours'] .= '&ndash;,0:00 &ndash; 0:00';
         }
         $instance['hours'] = str_replace(array("\r\n", "\r", "\n"), '</td></tr><tr><td>', $instance['hours']);
         $instance['hours'] = str_replace(array(',', ', '), '</td><td>', $instance['hours']);
         $instance['hours'] = str_replace('-', '&ndash;', $instance['hours']);
         $instance['hours'] = '<table><tr><td>' . $instance['hours'] . '</td></tr></table>';
         $address[20] = '<div class="hours contact-info"' . wma_schema_org('itemprop="openingHours"') . '>' . '<' . tag_escape($heading_tag) . $heading_atts . '>' . esc_html__('Business hours:', 'webman-amplifier') . '</' . tag_escape($heading_tag) . '>' . $instance['hours'] . '</div>';
     }
     // Phone numbers
     if (trim($instance['phone'])) {
         $address[30] = '<div class="phone contact-info"' . wma_schema_org('itemprop="telephone"') . '>' . '<' . tag_escape($heading_tag) . $heading_atts . '>' . esc_html__('Phone number:', 'webman-amplifier') . '</' . tag_escape($heading_tag) . '>' . $instance['phone'] . '</div>';
     }
     // Email addresses
     if (trim($instance['email'])) {
         preg_match_all('/(\\S+@\\S+\\.\\S+)/i', $instance['email'], $matches);
         if ($matches && is_array($matches)) {
             foreach ($matches[0] as $email) {
                 $instance['email'] = str_replace($email, '<a href="' . antispambot('mailto:' . $email) . '" data-address="' . antispambot($email) . '" class="email-nospam">' . antispambot($email) . '</a>', $instance['email']);
             }
         }
         $address[40] = '<div class="email contact-info"' . wma_schema_org('itemprop="email"') . '>' . '<' . tag_escape($heading_tag) . $heading_atts . '>' . esc_html__('Email address:', 'webman-amplifier') . '</' . tag_escape($heading_tag) . '>' . $instance['email'] . '</div>';
     }
     // Filter the $address and prepare it for output
     $address = implode('', (array) apply_filters('wmhook_widgets_' . 'wm_contact_info' . '_address', $address, $args, $instance));
     // Output wrapper
     if ($address) {
         $output .= '<div class="address-container"' . wma_schema_org('itemprop="sourceOrganization" itemscope itemtype="http://schema.org/LocalBusiness"') . '>' . apply_filters('wmhook_content_filters', $address) . '</div>';
     }
     // Output
     if ($output) {
         echo apply_filters('wmhook_widgets_' . 'wm_contact_info' . '_output', $args['before_widget'] . $output . $args['after_widget'], $args, $instance);
     }
 }
コード例 #4
0
	<?php 
if (0 < $helper['excerpt_length']) {
    echo '<div class="wm-posts-element wm-html-element excerpt"' . wma_schema_org('description') . '>' . wp_trim_words(get_the_excerpt(), $helper['excerpt_length'], '&hellip;') . '</div>';
}
?>

	<?php 
$terms = get_the_terms($helper['post_id'], 'category');
$terms_array = array();
if (!is_wp_error($terms) && !empty($terms)) {
    foreach ($terms as $term) {
        $terms_array[] = '<span class="term term-' . sanitize_html_class($term->slug) . '"' . wma_schema_org('itemprop="keywords"') . '>' . $term->name . '</span>';
    }
    echo '<div class="wm-posts-element wm-html-element taxonomy">' . implode(', ', $terms_array) . '</div>';
}
?>

	<div class="wm-posts-element wm-html-element more-link">
		<a href="<?php 
echo get_permalink();
?>
"<?php 
echo wma_schema_org('bookmark');
?>
><?php 
printf(apply_filters('wmhook_shortcode_' . 'posts_item_read_more_text', __('Read more <span class="screen-reader-text">about "%s"</span>&raquo;', 'webman-amplifier')), get_the_title());
?>
</a>
	</div>

</article>
コード例 #5
0
         // Posts single item output
         $class_item .= 'wm-testimonials-item wm-testimonials-item-' . $post_id;
         if (!$atts['testimonial']) {
             $class_item .= ' wm-column width-1-' . $atts['columns'] . $atts['no_margin'] . $alt;
         }
         if (!$atts['testimonial'] && (!$atts['no_margin'] || ' with-margin' === $atts['no_margin']) && !$atts['scroll'] && !$masonry_layout && $i % $atts['columns'] === 0) {
             $class_item .= ' last';
         }
         $terms = get_the_terms($post_id, 'testimonial_category');
         if (!is_wp_error($terms) && !empty($terms)) {
             foreach ($terms as $term) {
                 $class_item .= ' testimonial_category-' . $term->slug;
             }
         }
         $class_item = apply_filters('wmhook_shortcode_' . $shortcode . '_item_class', $class_item, $post_id, $atts);
         $output_item = '<article class="' . esc_attr($class_item) . '"' . wma_schema_org('review') . '>' . $output_item . '</article>';
     }
     $output .= apply_filters('wmhook_shortcode_' . $shortcode . '_item_output', $output_item, $class_item, $post_id, $atts);
     $alt = $alt ? '' : ' alt';
 }
 //Row
 $output .= $row_condition ? '</div>' : '';
 //Posts grid container closings
 if (!$atts['testimonial']) {
     if ($atts['content']) {
         if ('right' == $atts['align']) {
             //close posts container div and output description column
             $output .= '</div>' . $atts['pagination'] . '</div><div class="wm-column width-1-' . esc_attr($atts['desc_column_size']) . ' last wm-testimonials-description">' . $atts['content'] . '</div>';
         } else {
             //close the posts container div
             $output .= '</div>' . $atts['pagination'] . '</div>';
コード例 #6
0
ファイル: setup.php プロジェクト: KJaddoe/CSCMRA-Project
 function wm_schema_org($element = '', $output_meta_tag = false)
 {
     if (function_exists('wma_schema_org')) {
         return wma_schema_org($element, $output_meta_tag);
     }
     return;
 }
コード例 #7
0
    foreach ($terms as $term) {
        $terms_array[] = '<span class="term term-' . sanitize_html_class($term->slug) . '"' . wma_schema_org('itemprop="jobtitle"') . '>' . $term->name . '</span>';
    }
    echo '<div class="wm-posts-element wm-html-element taxonomy">' . implode(', ', $terms_array) . '</div>';
}
?>

	<div class="wm-posts-element wm-html-element content"<?php 
echo wma_schema_org('description');
?>
>
		<?php 
echo do_shortcode(wpautop(get_the_content()));
?>
	</div>

	<?php 
$staff_contacts = wma_meta_option('contacts', $helper['post_id']);
if ($staff_contacts && is_array($staff_contacts)) {
    echo '<ul class="wm-posts-element wm-html-element contacts">';
    foreach ($staff_contacts as $contact) {
        if (!isset($contact['icon']) || !isset($contact['title']) || !isset($contact['content'])) {
            continue;
        }
        echo '<li class="contacts-item ' . $contact['icon'] . '" title="' . $contact['title'] . '"' . wma_schema_org('itemprop="contactPoint"') . '>' . $contact['content'] . '</li>';
    }
    echo '</ul>';
}
?>

</article>
コード例 #8
0
ファイル: posts.php プロジェクト: pab44/pab44
     //Set posts container class
     $posts_container_class .= ' stack';
 }
 // /if scroll
 //Posts grid container openings
 $posts_container_class = apply_filters('wmhook_shortcode_' . $shortcode . '_posts_container_class', $posts_container_class, $atts);
 if ($atts['content']) {
     if ('right' == $atts['align']) {
         //open posts container div only
         $output .= '<div class="wm-column width-' . esc_attr($atts['desc_column_size'] - 1 . '-' . $atts['desc_column_size']) . '">' . $atts['filter'] . '<div class="' . esc_attr($posts_container_class) . '" data-columns="' . esc_attr($atts['columns']) . '" data-time="' . esc_attr(absint($atts['scroll'])) . '" data-layout-mode="' . esc_attr($atts['filter_layout']) . '"' . wma_schema_org('item_list') . '>';
     } else {
         //insert posts description (shortcode content) in a column and open the posts container div
         $output .= '<div class="wm-column width-1-' . esc_attr($atts['desc_column_size']) . ' wm-posts-description">' . $atts['content'] . '</div><div class="wm-column width-' . esc_attr($atts['desc_column_size'] - 1 . '-' . $atts['desc_column_size']) . ' last">' . $atts['filter'] . '<div class="' . esc_attr($posts_container_class) . '" data-columns="' . esc_attr($atts['columns']) . '" data-time="' . esc_attr(absint($atts['scroll'])) . '" data-layout-mode="' . esc_attr($atts['filter_layout']) . '"' . wma_schema_org('item_list') . '>';
     }
 } else {
     $output .= $atts['filter'] . '<div class="' . esc_attr($posts_container_class) . '" data-columns="' . esc_attr($atts['columns']) . '" data-time="' . esc_attr(absint($atts['scroll'])) . '" data-layout-mode="' . esc_attr($atts['filter_layout']) . '"' . wma_schema_org('item_list') . '>';
 }
 //Row
 $row_condition = !$atts['filter'] && !$atts['scroll'] && 1 != $atts['columns'] && !$masonry_layout;
 $output .= $row_condition ? '<div class="wm-row' . esc_attr($atts['no_margin']) . '">' : '';
 //Alternative item class and helper variables
 $alt = '';
 $row = $i = 0;
 // Loop the posts
 while ($posts->have_posts()) {
     $posts->the_post();
     $post_id = get_the_id();
     // Row
     if ($row_condition) {
         $row = ++$i % $atts['columns'] === 1 ? $row + 1 : $row;
         $output .= $i % $atts['columns'] === 1 && 1 < $row ? '</div><div class="wm-row' . esc_attr($atts['no_margin']) . '">' : '';
コード例 #9
0
    echo '<a' . $helper['link'] . wma_schema_org('bookmark') . '>';
}
the_title();
if ($helper['link']) {
    echo '</a>';
}
?>
		</<?php 
echo $helper['atts']['heading_tag'];
?>
>
	</div>

	<?php 
$terms = get_the_terms($helper['post_id'], 'project_category');
$terms_array = array();
if (!is_wp_error($terms) && !empty($terms)) {
    foreach ($terms as $term) {
        $terms_array[] = '<span class="term term-' . sanitize_html_class($term->slug) . '"' . wma_schema_org('itemprop="keywords"') . '>' . $term->name . '</span>';
    }
    echo '<div class="wm-posts-element wm-html-element taxonomy">' . implode(', ', $terms_array) . '</div>';
}
?>

	<?php 
if (0 < $helper['excerpt_length']) {
    echo '<div class="wm-posts-element wm-html-element excerpt"' . wma_schema_org('description') . '>' . wp_trim_words(get_the_excerpt(), $helper['excerpt_length'], '&hellip;') . '</div>';
}
?>

</article>