示例#1
0
 function shiword_allcat()
 {
     if (shiword_is_allcat()) {
         locate_template(array('allcat.php'), true, false);
         exit;
     }
 }
示例#2
0
    function shiword_navbuttons($print = 1, $comment = 1, $feed = 1, $trackback = 1, $home = 1, $next_prev = 1, $up_down = 1)
    {
        global $post;
        if (!shiword_get_opt('shiword_navbuttons')) {
            return;
        }
        wp_reset_postdata();
        $is_post = is_single() && !is_attachment() && !shiword_is_allcat();
        $is_image = is_attachment() && !shiword_is_allcat();
        $is_page = is_singular() && !is_single() && !is_attachment() && !shiword_is_allcat();
        $is_singular = is_singular() && !shiword_is_allcat();
        ?>

<div id="navbuttons">

	<?php 
        // ------- Print -------
        if (shiword_get_opt('shiword_navbuttons_print') && $print && $is_singular) {
            ?>
		<div class="minibutton">
			<a rel="nofollow" href="<?php 
            $query_vars['style'] = 'printme';
            if (get_query_var('page')) {
                $query_vars['page'] = esc_html(get_query_var('page'));
            }
            if (get_query_var('cpage')) {
                $query_vars['cpage'] = esc_html(get_query_var('cpage'));
            }
            echo esc_url(add_query_arg($query_vars, get_permalink($post->ID)));
            ?>
">
				<span class="minib_img minib_print">&nbsp;</span>
			</a>
			<span class="nb_tooltip"><?php 
            _e('print preview', 'shiword');
            ?>
</span>
		</div>
	<?php 
        }
        ?>

	<?php 
        // ------- Leave a comment -------
        if (shiword_get_opt('shiword_navbuttons_comment') && $comment && $is_singular && comments_open($post->ID) && !post_password_required()) {
            ?>
		<div class="minibutton">
			<a href="#respond">
				<span class="minib_img minib_comment">&nbsp;</span>
			</a>
			<span class="nb_tooltip"><?php 
            _e('Leave a comment', 'shiword');
            ?>
</span>
		</div>
	<?php 
        }
        ?>

	<?php 
        // ------- RSS feed -------
        if (shiword_get_opt('shiword_navbuttons_feed') && $feed && $is_singular && comments_open($post->ID) && !post_password_required()) {
            ?>
		<div class="minibutton">
			<a href="<?php 
            echo esc_url(get_post_comments_feed_link($post->ID, 'rss2'));
            ?>
 ">
				<span class="minib_img minib_rss">&nbsp;</span>
			</a>
			<span class="nb_tooltip"><?php 
            _e('feed for comments on this post', 'shiword');
            ?>
</span>
		</div>
	<?php 
        }
        ?>

	<?php 
        // ------- Trackback -------
        if (shiword_get_opt('shiword_navbuttons_trackback') && $trackback && $is_singular && pings_open()) {
            ?>
		<div class="minibutton">
			<a href="<?php 
            echo esc_url(get_trackback_url());
            ?>
" rel="trackback">
				<span class="minib_img minib_track">&nbsp;</span>
			</a>
			<span class="nb_tooltip"><?php 
            _e('Trackback URL', 'shiword');
            ?>
</span>
		</div>
	<?php 
        }
        ?>

	<?php 
        // ------- Home -------
        if (shiword_get_opt('shiword_navbuttons_home') && $home) {
            ?>
		<div class="minibutton">
			<a href="<?php 
            echo esc_url(home_url());
            ?>
">
				<span class="minib_img minib_home">&nbsp;</span>
			</a>
			<span class="nb_tooltip"><?php 
            _e('Home', 'shiword');
            ?>
</span>
		</div>
	<?php 
        }
        ?>

	<?php 
        // ------- Back to parent post -------
        if ($is_image) {
            ?>
		<?php 
            if (!empty($post->post_parent)) {
                ?>
			<div class="minibutton">
				<a href="<?php 
                echo esc_url(get_permalink($post->post_parent));
                ?>
" rel="gallery">
					<span class="minib_img minib_backtopost">&nbsp;</span>
				</a>
				<span class="nb_tooltip"><?php 
                esc_attr(printf(__('Return to %s', 'shiword'), get_the_title($post->post_parent)));
                ?>
</span>
			</div>
		<?php 
            }
            ?>
	<?php 
        }
        ?>

	<?php 
        // ------- Next post -------
        if (shiword_get_opt('shiword_navbuttons_nextprev') && $next_prev && $is_post && get_next_post()) {
            ?>
		<div class="minibutton">
			<a href="<?php 
            echo esc_url(get_permalink(get_next_post()));
            ?>
">
				<span class="minib_img minib_npage">&nbsp;</span>
			</a>
			<span class="nb_tooltip"><?php 
            esc_attr(printf(__('Next Post', 'shiword') . ': %s', get_the_title(get_next_post())));
            ?>
</span>
		</div>
	<?php 
        }
        ?>

	<?php 
        // ------- Previous post -------
        if (shiword_get_opt('shiword_navbuttons_nextprev') && $next_prev && $is_post && get_previous_post()) {
            ?>
		<div class="minibutton">
			<a href="<?php 
            echo esc_url(get_permalink(get_previous_post()));
            ?>
">
				<span class="minib_img minib_ppage">&nbsp;</span>
			</a>
			<span class="nb_tooltip"><?php 
            esc_attr(printf(__('Previous Post', 'shiword') . ': %s', get_the_title(get_previous_post())));
            ?>
</span>
		</div>
	<?php 
        }
        ?>

	<?php 
        // ------- Newer Posts -------
        if (shiword_get_opt('shiword_navbuttons_newold') && $next_prev && !$is_singular && !shiword_is_allcat() && get_previous_posts_link()) {
            ?>
		<div class="minibutton hide-if-infinite">
			<?php 
            previous_posts_link('<span class="minib_img minib_ppages">&nbsp;</span>');
            ?>
			<span class="nb_tooltip"><?php 
            echo __('Newer Posts', 'shiword');
            ?>
</span>
		</div>
	<?php 
        }
        ?>

	<?php 
        // ------- Older Posts -------
        if (shiword_get_opt('shiword_navbuttons_newold') && $next_prev && !$is_singular && !shiword_is_allcat() && get_next_posts_link()) {
            ?>
		<div class="minibutton hide-if-infinite">
			<?php 
            next_posts_link('<span class="minib_img minib_npages">&nbsp;</span>');
            ?>
			<span class="nb_tooltip"><?php 
            echo __('Older Posts', 'shiword');
            ?>
</span>
		</div>
	<?php 
        }
        ?>

	<?php 
        // ------- Top -------
        if (shiword_get_opt('shiword_navbuttons_topbottom') && $up_down) {
            ?>
		<div class="minibutton">
			<a href="#">
				<span class="minib_img minib_top">&nbsp;</span>
			</a>
			<span class="nb_tooltip"><?php 
            _e('Top of page', 'shiword');
            ?>
</span>
		</div>
	<?php 
        }
        ?>

	<?php 
        // ------- Bottom -------
        if (shiword_get_opt('shiword_navbuttons_topbottom') && $up_down) {
            ?>
		<div class="minibutton">
			<a href="#footer">
				<span class="minib_img minib_bottom">&nbsp;</span>
			</a>
			<span class="nb_tooltip"><?php 
            _e('Bottom of page', 'shiword');
            ?>
</span>
		</div>
	<?php 
        }
        ?>
	<div class="fixfloat"> </div>
</div>

<?php 
    }