예제 #1
0
function fastfood_single_nav()
{
    global $post;
    if (!is_single()) {
        return;
    }
    $next = get_next_post();
    $prev = get_previous_post();
    $next_title = get_the_title($next) ? get_the_title($next) : __('Next Post', 'fastfood');
    $prev_title = get_the_title($prev) ? get_the_title($prev) : __('Previous Post', 'fastfood');
    $output = '';
    if ($prev) {
        $output .= fastfood_build_link(array('href' => get_permalink($prev), 'text' => '<span>' . $prev_title . '</span>' . fastfood_get_the_thumb(array('id' => $prev->ID, 'size' => array(32, 32), 'class' => 'tb-thumb-format')), 'title' => esc_attr(strip_tags(__('Previous Post', 'fastfood') . ': ' . $prev_title)), 'class' => 'nav-previous el-icon-chevron-left', 'rel' => 'prev'));
    }
    if ($next) {
        $output .= fastfood_build_link(array('href' => get_permalink($next), 'text' => '<span>' . $next_title . '</span>' . fastfood_get_the_thumb(array('id' => $next->ID, 'size' => array(32, 32), 'class' => 'tb-thumb-format')), 'title' => esc_attr(strip_tags(__('Next Post', 'fastfood') . ': ' . $next_title)), 'class' => 'nav-next el-icon-chevron-right', 'rel' => 'next'));
    }
    if (!$output) {
        return;
    }
    ?>

		<div class="nav-single">
			<?php 
    echo $output;
    ?>
		</div><!-- #nav-single -->

	<?php 
}
예제 #2
0
fastfood_extrainfo(array('tags' => 0, 'cats' => 0));
?>

	<div class="entry-content entry-attachment">

		<?php 
fastfood_hook_attachment_before();
?>

			<p class="attachment">
		<?php 
if (wp_attachment_is_image()) {
    ?>

				<?php 
    echo fastfood_build_link(array('href' => wp_get_attachment_url(), 'text' => wp_get_attachment_image($post->ID, 'full'), 'title' => __('View full size', 'fastfood'), 'rel' => 'attachment'));
    ?>

			<?php 
    if (!empty($post->post_excerpt)) {
        the_excerpt();
    }
    ?>

		<?php 
} else {
    ?>

			<?php 
    echo wp_get_attachment_link($post->ID, 'thumbnail', 0, 1);
    ?>
예제 #3
0
function fastfood_extrainfo($args = '')
{
    $defaults = array('auth' => FastfoodOptions::get_opt('fastfood_xinfos_byauth'), 'date' => FastfoodOptions::get_opt('fastfood_xinfos_date'), 'comms' => FastfoodOptions::get_opt('fastfood_xinfos_comm'), 'tags' => FastfoodOptions::get_opt('fastfood_xinfos_tag'), 'cats' => FastfoodOptions::get_opt('fastfood_xinfos_cat'), 'hiera' => FastfoodOptions::get_opt('fastfood_xinfos_hiera'), 'list_view' => FastfoodOptions::get_opt('fastfood_xinfos_static'));
    $args = wp_parse_args($args, $defaults);
    //xinfos disabled when...
    if (!FastfoodOptions::get_opt('fastfood_xinfos_global')) {
        return;
    }
    //xinfos globally disabled
    if (is_page() && is_front_page() && !FastfoodOptions::get_opt('fastfood_xinfos_on_front')) {
        return;
    }
    // is front page
    if (is_page() && !FastfoodOptions::get_opt('fastfood_xinfos_on_page')) {
        return;
    }
    if (is_single() && !FastfoodOptions::get_opt('fastfood_xinfos_on_post')) {
        return;
    }
    if (!is_singular() && !FastfoodOptions::get_opt('fastfood_xinfos_on_list')) {
        return;
    }
    if (is_page()) {
        $page_cd_nc = !comments_open() && !have_comments();
        //true if page with comments disabled and no comments
        if ($page_cd_nc) {
            $args['comms'] = false;
        }
        $args['auth'] = false;
        $args['date'] = false;
        $args['tags'] = false;
        $args['cats'] = false;
    }
    $post_author = $args['auth'] === true || $args['auth'] === 1 ? '<a class="fn author nickname url" href="' . get_author_posts_url(get_the_author_meta('ID')) . '" title="' . sprintf(__('View all posts by %s', 'fastfood'), esc_attr(get_the_author())) . '">' . get_the_author() . '</a>' : '<span class="vcard fn author">' . $args['auth'] . '</span>';
    $post_author = '<span class="hide_if_no_print">' . __('Author', 'fastfood') . ': </span><i class="el-icon-user"></i> ' . $post_author;
    $categories = get_the_category_list(', ');
    $tags = get_the_tags() ? get_the_tag_list('', ', ', '') : __('No Tags', 'fastfood');
    $comments = fastfood_get_comments_link();
    $date = '<span class="published" title="' . get_the_time('c') . '">' . get_the_time(get_option('date_format')) . '</span>';
    $hierarchy = fastfood_multipages();
    $edit_post_link = !get_edit_post_link() ? false : fastfood_build_link(array('href' => get_edit_post_link(), 'text' => '<i class="el-icon-pencil"></i><span class="screen-reader-text">' . __('Edit', 'fastfood') . '</span>', 'title' => __('Edit', 'fastfood'), 'rel' => 'nofollow'));
    $metadata = array();
    if ($args['auth']) {
        $metadata['author'] = array('trigger' => $post_author, 'content' => '');
    }
    if ($args['date']) {
        $metadata['date'] = array('trigger' => '<i class="el-icon-calendar"></i>', 'content' => $date);
    }
    if ($args['cats']) {
        $metadata['categories'] = array('trigger' => '<i class="el-icon-folder-open"></i>', 'content' => $categories);
    }
    if ($args['tags']) {
        $metadata['tags'] = array('trigger' => '<i class="el-icon-tags"></i>', 'content' => $tags);
    }
    if ($args['comms']) {
        $metadata['comments'] = array('trigger' => '<i class="el-icon-comment"></i>', 'content' => $comments);
    }
    if ($args['hiera'] && $hierarchy) {
        $metadata['hierarchy'] = array('trigger' => '<i class="el-icon-fork"></i>', 'content' => $hierarchy);
    }
    if ($edit_post_link) {
        $metadata['edit'] = array('trigger' => $edit_post_link, 'content' => '');
    }
    $metadata = apply_filters('fastfood_post_metadata', $metadata);
    if ($metadata) {
        ?>

		<div class="metadata <?php 
        echo $args['list_view'] ? 'static' : 'dropdown';
        ?>
">

			<?php 
        foreach ($metadata as $m_key => $data) {
            ?>

				<div class="metadata-panel metadata-panel-<?php 
            echo $m_key;
            echo $data['content'] ? ' has-content' : '';
            ?>
">
					<span class="metadata-panel-trigger"><?php 
            echo $data['trigger'];
            ?>
</span>
					<?php 
            if ($data['content']) {
                ?>
						<div class="metadata-panel-content">
							<?php 
                echo $data['content'];
                ?>
						</div>
					<?php 
            }
            ?>
				</div>

			<?php 
        }
        ?>

		</div>

		<?php 
    }
}
예제 #4
0
/**
 * Display the navigation images
 *
 * @param	mixed	$post		(optional) the post (ID or object)
 * @return	none
*/
function fastfood_navigate_images($post = null)
{
    if (!($post = get_post($post))) {
        return;
    }
    if (!wp_attachment_is_image($post->ID)) {
        return;
    }
    $images = fastfood_get_prevnext_images($post->ID);
    if ($images['prev']) {
        $images['prev'] = fastfood_build_link(array('href' => get_attachment_link($images['prev']), 'text' => '<i class="el-icon-chevron-left"></i> ' . wp_get_attachment_image($images['prev'], array(70, 70)), 'class' => 'size-thumbnail', 'rel' => 'prev'));
    }
    if ($images['next']) {
        $images['next'] = fastfood_build_link(array('href' => get_attachment_link($images['next']), 'text' => wp_get_attachment_image($images['next'], array(70, 70)) . '<i class="el-icon-chevron-right"></i>', 'class' => 'size-thumbnail', 'rel' => 'next'));
    }
    ?>
	<div class="img-navi">

		<?php 
    echo $images['prev'];
    ?>
		<span class="img-navi-curimg"><?php 
    echo wp_get_attachment_image($post->ID, array(70, 70));
    ?>
</span>
		<?php 
    echo $images['next'];
    ?>

	</div>
<?php 
}
예제 #5
0
    /**
     * Display Popular Categories (with related posts)
     *
     * @since Fastfood 0.37
     */
    function qbar_popular_categories()
    {
        $args = array('orderby' => 'count', 'number' => apply_filters('fastfood_filter_get_categories_wpr_number', absint(FastfoodOptions::get_opt('fastfood_qbar_cat_length'))), 'order' => 'DESC');
        $categories = get_categories($args);
        if (!$categories) {
            return;
        }
        ?>

			<ul class="solid_ul">

				<?php 
        foreach ($categories as $category) {
            ?>

					<li>
						<?php 
            echo '<span class="label">' . fastfood_build_link(array('href' => get_category_link($category->term_id), 'text' => $category->name, 'title' => sprintf(__("View all posts in %s", 'fastfood'), $category->name))) . ' (' . $category->count . ')' . '</span>';
            ?>
						<div class="quickbar-panel-subcontent">
							<div class="quickbar-panel-title"><?php 
            _e('Recent Posts', 'fastfood');
            ?>
</div>
							<ul class="solid_ul">
								<?php 
            $tmp_cat_ID = $category->cat_ID;
            $post_search_args = array('numberposts' => absint(FastfoodOptions::get_opt('fastfood_qbar_cat_length')), 'category' => $tmp_cat_ID, 'no_found_rows' => true);
            $lastcatposts = get_posts($post_search_args);
            foreach ($lastcatposts as $post) {
                setup_postdata($post);
                $post_title = get_the_title($post->ID);
                //trim the post title if > 35 chars
                $post_title_short = mb_strimwidth($post_title, 0, 35, '&hellip;');
                //trim the post author if > 20 chars
                $post_auth = mb_strimwidth(get_the_author(), 0, 20, '&hellip;');
                ?>

								<li>
									<?php 
                echo '<span class="label">' . sprintf(apply_filters('fastfood_filter_post_by_author', __('%1$s by %2$s', 'fastfood')), fastfood_build_link(array('href' => get_permalink($post->ID), 'text' => $post_title_short, 'title' => the_title_attribute(array('echo' => 0, 'post' => $post->ID)))), $post_auth) . '</span>';
                ?>
								</li>

								<?php 
            }
            ?>

							</ul>
						</div>
					</li>

				<?php 
        }
        ?>

				<li class="all_cat"><span class="label"><a title="<?php 
        _e('View all categories', 'fastfood');
        ?>
" href="<?php 
        echo esc_url(add_query_arg(array('allcat' => 'y'), home_url('/')));
        ?>
">[...]</a></span></li>

			</ul>

		<?php 
        wp_reset_postdata();
    }
예제 #6
0
<?php

/**
 * post.php
 *
 * standard post (without format) (list view)
 *
 * @package fastfood
 * @since fastfood 0.29
 */
?>

<div class="featured-post">

	<?php 
echo wp_get_attachment_image(fastfood_get_the_thumb_id(), 'thumbnail');
?>

	<h2 class="entry-title"><?php 
echo fastfood_build_link(array('href' => get_permalink(), 'text' => get_the_title(), 'title' => the_title_attribute(array('echo' => 0)), 'class' => 'entry-title-content'));
?>
</h2>

	<div class="entry-content">
		<?php 
the_excerpt();
?>
	</div>

</div>