示例#1
0
文件: loop.php 项目: kanenas/receptar
<?php

/**
 * Default WordPress posts loop
 *
 * @package    Receptar
 * @copyright  2015 WebMan - Oliver Juhas
 *
 * @since    1.0
 * @version  1.3
 */
if (have_posts()) {
    wmhook_postslist_before();
    echo '<div id="posts" class="posts posts-list clearfix"' . receptar_schema_org('ItemList') . '>';
    wmhook_postslist_top();
    while (have_posts()) {
        the_post();
        get_template_part('template-parts/content', apply_filters('wmhook_loop_content_type', get_post_format()));
    }
    wmhook_postslist_bottom();
    echo '</div>';
    wmhook_postslist_after();
} else {
    get_template_part('template-parts/content', 'none');
}
wp_reset_query();
?>

		</figure>

	</div>

	<?php 
/**
 * Post title
 */
?>

	<div class="site-banner-header">

		<h1 class="entry-title"<?php 
echo receptar_schema_org('name');
?>
>
			<a href="<?php 
echo esc_url(get_permalink());
?>
" class="highlight" rel="bookmark"><?php 
if ($custom_title = trim(get_post_meta(get_the_ID(), 'banner_text', true))) {
    //Display 'banner_text' custom field if set
    echo $custom_title;
} else {
    //If no 'banner_text' custom field set, fall back to post title
    the_title();
}
?>
</a>
示例#3
0
 function receptar_footer_top()
 {
     //Preparing output
     $output = "\r\n\r\n" . '<footer id="colophon" class="site-footer"' . receptar_schema_org('WPFooter') . '>' . "\r\n\r\n";
     //Output
     echo $output;
 }
示例#4
0
?>

			</nav>



			<?php 
/**
 * Sidebar
 */
if (is_active_sidebar('sidebar')) {
    wmhook_sidebars_before();
    ?>

					<div class="widget-area sidebar" role="complementary"<?php 
    echo receptar_schema_org('WPSideBar');
    ?>
>

						<?php 
    wmhook_sidebar_top();
    dynamic_sidebar('sidebar');
    wmhook_sidebar_bottom();
    ?>

					</div>

					<?php 
    wmhook_sidebars_after();
}
do_action('wmhook_secondary_content_bottom');
示例#5
0
        echo '<img src="' . apply_filters('wmhook_entry_featured_image_fallback_url', '') . '" alt="' . the_title_attribute('echo=0') . '" title="' . the_title_attribute('echo=0') . '" />';
    }
    if (!empty($image_link)) {
        echo '</a>';
    }
    ?>

			</figure>

		</div>

		<?php 
}
/**
 * Post content
 */
echo '<div class="entry-inner">';
wmhook_entry_top();
echo '<div class="entry-content"' . receptar_schema_org('entry_body') . '>';
if (!is_singular() || is_single() && has_excerpt() && !$pagination_suffix) {
    the_excerpt();
}
if (is_singular()) {
    the_content(apply_filters('wmhook_receptar_excerpt_continue_reading', ''));
}
echo '</div>';
wmhook_entry_bottom();
echo '</div>';
?>

</article>
示例#6
0
文件: core.php 项目: kanenas/receptar
 function receptar_post_meta($args = array())
 {
     //Helper variables
     $output = '';
     $args = wp_parse_args($args, apply_filters('wmhook_receptar_post_meta_defaults', array('class' => 'entry-meta clearfix', 'date_format' => null, 'html' => '<span class="{class}"{attributes}>{content}</span> ', 'html_custom' => array('date' => '<time datetime="{datetime}" class="{class}"{attributes}>{content}</time> '), 'meta' => array(), 'post_id' => null, 'post' => null)));
     $args = apply_filters('wmhook_receptar_post_meta_args', $args);
     $args['meta'] = array_filter((array) $args['meta']);
     if ($args['post_id']) {
         $args['post_id'] = absint($args['post_id']);
         $args['post'] = get_post($args['post_id']);
     }
     //Requirements check
     if (empty($args['meta'])) {
         return;
     }
     //Preparing output
     foreach ($args['meta'] as $meta) {
         //Allow custom metas
         $helper = '';
         $replacements = (array) apply_filters('wmhook_receptar_post_meta_replacements', array(), $meta, $args);
         $single_output = apply_filters('wmhook_receptar_post_meta', '', $meta, $args);
         $output .= $single_output;
         //Predefined metas
         switch ($meta) {
             case 'author':
                 if (apply_filters('wmhook_receptar_post_meta_enable_' . $meta, true, $args)) {
                     $replacements = array('{attributes}' => receptar_schema_org('Person'), '{class}' => 'author vcard entry-meta-element', '{content}' => '<a href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '" class="url fn n" rel="author"' . receptar_schema_org('author') . '>' . get_the_author() . '</a>');
                 }
                 break;
             case 'category':
                 if (apply_filters('wmhook_receptar_post_meta_enable_' . $meta, true, $args) && receptar_is_categorized_blog() && ($helper = get_the_category_list(', ', '', $args['post_id']))) {
                     $replacements = array('{attributes}' => '', '{class}' => 'cat-links entry-meta-element', '{content}' => $helper);
                 }
                 break;
             case 'comments':
                 if (apply_filters('wmhook_receptar_post_meta_enable_' . $meta, true, $args) && !post_password_required() && (comments_open($args['post_id']) || get_comments_number($args['post_id']))) {
                     $helper = get_comments_number($args['post_id']);
                     //Don't know why this can not be in IF condition, but otherwise it won't work...
                     $element_id = $helper ? '#comments' : '#respond';
                     $replacements = array('{attributes}' => '', '{class}' => 'comments-link entry-meta-element', '{content}' => '<a href="' . esc_url(get_permalink($args['post_id'])) . $element_id . '" title="' . esc_attr(sprintf(esc_html_x('Comments: %d', '%d: number of comments.', 'receptar'), $helper)) . '"><span class="comments-title">' . esc_html_x('Comments:', 'Title for number of comments in post meta.', 'receptar') . ' </span><span class="comments-count">' . $helper . '</span></a>');
                 }
                 break;
             case 'date':
                 if (apply_filters('wmhook_receptar_post_meta_enable_' . $meta, true, $args)) {
                     $replacements = array('{attributes}' => ' title="' . esc_attr(get_the_date()) . ' | ' . esc_attr(get_the_time('', $args['post'])) . '"' . receptar_schema_org('datePublished'), '{class}' => 'entry-date entry-meta-element published', '{content}' => esc_html(get_the_date($args['date_format'])), '{datetime}' => esc_attr(get_the_date('c')));
                 }
                 break;
             case 'edit':
                 if (apply_filters('wmhook_receptar_post_meta_enable_' . $meta, true, $args) && ($helper = get_edit_post_link($args['post_id']))) {
                     $the_title_attribute_args = array('echo' => false);
                     if ($args['post_id']) {
                         $the_title_attribute_args['post'] = $args['post'];
                     }
                     $replacements = array('{attributes}' => '', '{class}' => 'entry-edit entry-meta-element', '{content}' => '<a href="' . esc_url($helper) . '" title="' . esc_attr(sprintf(esc_html__('Edit the "%s"', 'receptar'), the_title_attribute($the_title_attribute_args))) . '"><span>' . esc_html_x('Edit', 'Edit post link.', 'receptar') . '</span></a>');
                 }
                 break;
             case 'likes':
                 if (apply_filters('wmhook_receptar_post_meta_enable_' . $meta, true, $args) && function_exists('zilla_likes')) {
                     global $zilla_likes;
                     $helper = $zilla_likes->do_likes();
                     $replacements = array('{attributes}' => '', '{class}' => 'entry-likes entry-meta-element', '{content}' => $helper);
                 }
                 break;
             case 'permalink':
                 if (apply_filters('wmhook_receptar_post_meta_enable_' . $meta, true, $args)) {
                     $the_title_attribute_args = array('echo' => false);
                     if ($args['post_id']) {
                         $the_title_attribute_args['post'] = $args['post'];
                     }
                     $replacements = array('{attributes}' => receptar_schema_org('url'), '{class}' => 'entry-permalink entry-meta-element', '{content}' => '<a href="' . esc_url(get_permalink($args['post_id'])) . '" title="' . esc_attr(sprintf(esc_html__('Permalink to "%s"', 'receptar'), the_title_attribute($the_title_attribute_args))) . '" rel="bookmark"><span>' . get_the_title($args['post_id']) . '</span></a>');
                 }
                 break;
             case 'tags':
                 if (apply_filters('wmhook_receptar_post_meta_enable_' . $meta, true, $args) && ($helper = get_the_tag_list('', ' ', '', $args['post_id']))) {
                     $replacements = array('{attributes}' => receptar_schema_org('keywords'), '{class}' => 'tags-links entry-meta-element', '{content}' => $helper);
                 }
                 break;
             case 'views':
                 if (apply_filters('wmhook_receptar_post_meta_enable_' . $meta, true, $args) && function_exists('bawpvc_views_sc') && ($helper = bawpvc_views_sc(array()))) {
                     $replacements = array('{attributes}' => ' title="' . esc_html__('Views count', 'receptar') . '"', '{class}' => 'entry-views entry-meta-element', '{content}' => $helper);
                 }
                 break;
             default:
                 break;
         }
         // /switch
         //Single meta output
         $replacements = (array) apply_filters('wmhook_receptar_post_meta_replacements_' . $meta, $replacements, $args);
         if (empty($single_output) && !empty($replacements)) {
             if (isset($args['html_custom'][$meta])) {
                 $output .= strtr($args['html_custom'][$meta], (array) $replacements);
             } else {
                 $output .= strtr($args['html'], (array) $replacements);
             }
         }
     }
     // /foreach
     if ($output) {
         $output = '<div class="' . esc_attr($args['class']) . '">' . $output . '</div>';
     }
     //Output
     return apply_filters('wmhook_receptar_post_meta_output', $output, $args);
 }
if (!empty($image_link)) {
    echo '</a>';
}
?>

			</figure>

		</div>

		<?php 
/**
 * Post content
 */
echo '<div class="entry-inner">';
wmhook_entry_top();
echo '<div class="entry-content"' . receptar_schema_org('itemprop="description"') . '>';
?>

				<table>
					<tbody>
						<tr class="date">
							<th><?php 
echo esc_html_x('Image published on:', 'Attachment page publish time.', 'receptar');
?>
</th>
							<td><?php 
the_time(get_option('date_format'));
?>
</td>
						</tr>
						<tr class="size">