/** * Displays navigation to next/previous post when applicable. * * @since Twenty Thirteen 1.0 * * @return void */ function activetheme_post_nav() { global $post; // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post($post->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } ?> <nav class="navigation post-navigation" role="navigation"> <?php /* <h1 class="screen-reader-text"><?php _e( 'Post navigation', 'activetheme' ); ?></h1> */ ?> <div class="nav-links clearfix"> <?php if (is_singular('article')) { previous_post_link('%link', _x('<span class="meta-nav meta-nav-prev">←</span> Previous Article', 'Previous article link', 'activetheme')); next_post_link('%link', _x('Next Article <span class="meta-nav meta-nav-next">→</span>', 'Next article link', 'activetheme')); } else { previous_post_link('%link', _x('<span class="meta-nav meta-nav-prev">←</span> Previous Post', 'Previous post link', 'activetheme')); next_post_link('%link', _x('Next Post <span class="meta-nav meta-nav-next">→</span>', 'Next post link', 'activetheme')); } ?> </div><!-- .nav-links --> </nav><!-- .navigation --> <?php }
/** * Display navigation to next/previous post when applicable. */ function post_nav() { // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous || is_singular('page')) { return; } $_previous_post_link = get_previous_post_link('<div class="nav-previous">%link</div>', _x('<span class="meta-nav">←</span> %title', 'Previous post link', 'the-one')); $_next_post_link = get_next_post_link('<div class="nav-next">%link</div>', _x('%title <span class="meta-nav">→</span>', 'Next post link', 'the-one')); ?> <nav class="navigation post-navigation" role="navigation"> <h4 class="screen-reader-text"><?php _e('Post navigation', 'the-one'); ?> </h4> <div class="nav-links"> <?php if (!empty($_previous_post_link) && !empty($_next_post_link)) { echo $_previous_post_link . $_next_post_link; } elseif (!empty($_previous_post_link)) { echo $_previous_post_link; } elseif (!empty($_next_post_link)) { echo '<div class="nav-previous"></div>' . $_next_post_link; } ?> </div><!-- .nav-links --> </nav><!-- .navigation --> <?php }
/** * Display navigation to next/previous post when applicable. * * @since DSW oddil 1.0 */ function dswoddil_post_nav() { // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } ?> <nav class="navigation post-navigation" role="navigation"> <h1 class="screen-reader-text"><?php _e('Post navigation', 'dswoddil'); ?> </h1> <div class="nav-links"> <?php if (is_attachment()) { previous_post_link('%link', __('<span class="meta-nav">Published In</span>%title', 'dswoddil')); } else { previous_post_link('%link', __('<span class="meta-nav">Previous Post</span>%title', 'dswoddil')); next_post_link('%link', __('<span class="meta-nav">Next Post</span>%title', 'dswoddil')); } ?> </div><!-- .nav-links --> </nav><!-- .navigation --> <?php }
/** * Display navigation to next/previous post when applicable. * * @todo Remove this function when WordPress 4.3 is released. */ function the_post_navigation() { // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } ?> <nav class="navigation post-navigation col-xs-12" role="navigation"> <h2 class="screen-reader-text"><?php _e('Post navigation', 'flat-sassy-boots'); ?> </h2> <div class="nav-links"> <?php //previous_post_link( '<div class="nav-previous"><div class="nav-indicator">' . _x( 'Previous Post:', 'Previous post', 'flat-sassy-boots' ) . '</div><h1>%link</h1><i class="fa fa-arrow-left"></i></div>', '%title' ); //next_post_link( '<div class="nav-next"><div class="nav-indicator">' . _x( 'Next Post:', 'Next post', 'flat-sassy-boots' ) . '</div><h1>%link</h1><i class="fa fa-arrow-right"></i></div>', '%title' ); previous_post_link('<div class="nav-previous"><strong>%link</strong></div>', '%title'); next_post_link('<div class="nav-next"><strong>%link</strong></div>', '%title'); ?> </div><!-- .nav-links --> </nav><!-- .navigation --> <?php }
/** * Displays navigation to next/previous post when applicable. * * @since Twenty Thirteen 1.0 * * @return void */ function twentythirteen_post_nav() { global $post; // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post($post->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } ?> <nav class="navigation post-navigation" role="navigation"> <h1 class="screen-reader-text"><?php _e('Post navigation', 'twentythirteen'); ?> </h1> <div class="nav-links"> <?php /* if ( ! next_post_link('%link') ) { echo "Test!"; } */ previous_post_link('%link', _x('<span class="meta-nav">←</span> %title', 'Previous post link', 'twentythirteen'), $in_same_cat = true); ?> <?php next_post_link('%link', _x('%title <span class="meta-nav">→</span>', 'Next post link', 'twentythirteen'), $in_same_cat = true); ?> </div><!-- .nav-links --> </nav><!-- .navigation --> <?php }
/** * Display navigation to next/previous post when applicable. * * @since Twenty Fourteen 1.0 * * @return void */ function panopta2014_post_nav() { // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } ?> <div class="row"> <div class="col-xs-12 col-sm-11 col-sm-offset-1"> <nav class="navigation post-navigation" role="navigation"> <div class="nav-links row"> <?php if (is_attachment()) { previous_post_link('%link', __('<div class="col-xs-12"><span class="meta-nav">Published In</span>%title</div>', 'twentyfourteen')); } else { previous_post_link('<div class="col-xs-12 col-sm-6">%link</div>', __('<i class="fa fa-angle-left"></i> <span class="meta-nav">Previous: </span>%title', 'twentyfourteen')); next_post_link('<div class="col-xs-12 col-sm-6">%link</div>', __('<span class="meta-nav">Next: </span>%title <i class="fa fa-angle-right"></i>', 'twentyfourteen')); } ?> </div><!-- .nav-links --> </nav><!-- .navigation --> </div> </div> <?php }
/** * Display navigation to next/previous post when applicable. */ function zerif_post_nav() { // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } ?> <nav class="navigation post-navigation" role="navigation"> <h1 class="screen-reader-text"><?php _e('Post navigation', 'zerif-lite'); ?> </h1> <div class="row nav-links"> <?php previous_post_link('<div class="col-md-4 text-left nav-previous">%link</div>', _x('<span class="meta-nav">←</span> %title', 'Previous post link', 'zerif-lite')); echo '<div class="col-md-4 text-center"><a href="http://localhost/blog">Home</a></div>'; next_post_link('<div class="col-md-4 text-right nav-next">%link</div>', _x('%title <span class="meta-nav">→</span>', 'Next post link', 'zerif-lite')); ?> </div><!-- .nav-links --> </nav><!-- .navigation --> <?php }
/** * Display navigation to next/previous post when applicable. * * @since Twenty Fifteen 1.0 */ function twentyfifteen_post_nav() { // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous || is_attachment() && 'attachment' == $previous->post_type) { return; } $prev_class = $next_class = ''; if ($previous && has_post_thumbnail($previous->ID)) { $prev_class = " has-post-thumbnail"; } if ($next && has_post_thumbnail($next->ID)) { $next_class = " has-post-thumbnail"; } ?> <nav class="navigation post-navigation" role="navigation"> <h1 class="screen-reader-text"><?php esc_html_e('Post navigation', 'twentyfifteen'); ?> </h1> <div class="nav-links"> <?php if (is_attachment()) { previous_post_link('<div class="nav-previous' . $prev_class . '">%link</div>', _x('<span class="meta-nav">Published In</span><span class="post-title">%title</span>', 'Parent post link', 'twentyfifteen')); } else { previous_post_link('<div class="nav-previous' . $prev_class . '">%link</div>', _x('<span class="meta-nav">Previous</span><span class="post-title">%title</span>', 'Previous post link', 'twentyfifteen')); next_post_link('<div class="nav-next' . $next_class . '">%link</div>', _x('<span class="meta-nav">Next</span><span class="post-title">%title</span>', 'Next post link', 'twentyfifteen')); } ?> </div><!-- .nav-links --> </nav><!-- .post-navigation --> <?php }
/** * Display navigation to next/previous post when applicable. */ function jose_post_nav() { // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } ?> <?php previous_post_link('<div class="item_nav nav-previous">%link</div>', _x('<span class="meta-nav"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="60" height="60" viewBox="0 0 60 60"> <g id="icomoon-ignore"> <line stroke-width="1" x1="" y1="" x2="" y2="" stroke="#449FDB" opacity=""></line> </g> <path d="M43.197 52.254c0.804 0.813 0.804 2.124 0 2.937s-2.103 0.813-2.907 0l-23.49-23.721c-0.804-0.813-0.804-2.127 0-2.937l23.49-23.724c0.804-0.813 2.103-0.813 2.907 0s0.804 2.124 0 2.937l-21.42 22.254 21.42 22.254z" class="blob"></path> </svg></span> ', 'Previous post link', 'jose')); next_post_link('<div class="item_nav nav-next">%link</div>', _x(' <span class="meta-nav"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="60" height="60" viewBox="0 0 60 60"> <g id="icomoon-ignore"> <line stroke-width="1" x1="" y1="" x2="" y2="" stroke="#449FDB" opacity=""></line> </g> <path d="M16.799 52.254c-0.804 0.813-0.804 2.124 0 2.937s2.103 0.813 2.907 0l23.49-23.721c0.804-0.813 0.804-2.127 0-2.937l-23.49-23.724c-0.804-0.813-2.103-0.813-2.907 0s-0.804 2.124 0 2.937l21.42 22.254-21.42 22.254z" class="blob"></path> </svg></span>', 'Next post link', 'jose')); ?> <?php }
/** * Display navigation to next/previous post when applicable. * * @return void */ function cover_post_nav() { // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } ?> <nav class="navigation post-navigation" role="navigation"> <h1 class="screen-reader-text"><?php _e('Post navigation', 'cover'); ?> </h1> <div class="nav-links cf"> <?php if ($previous) { previous_post_link('<div class="nav-previous">%link</div>', _x('<h2 class="subtitle">' . __('Previous post', 'cover') . '</h2><h1 class="title">%title</h1>', 'Previous post link', 'cover')); } if ($next) { $next_img_array = wp_get_attachment_image_src(get_post_thumbnail_id($next->ID), 'single-post-thumbnail'); $next_img = $next_img_array[0]; $class = ''; $style = ''; if ('' != $next_img) { $class = ' featured-image'; $style = ' style="background-image: url(\'' . $next_img . '\')"'; } next_post_link('<div class="nav-next">%link</div>', _x('<div class="cover' . $class . '"><div class="cover-background"' . $style . '></div><div class="cover-header"><h2 class="cover-subtitle">' . __('Next post', 'cover') . '</h2><h1 class="cover-title">%title</h1></div></div>', 'Next post link', 'cover')); } ?> </div><!-- .nav-links --> </nav><!-- .navigation --> <?php }
function ct_tracks_further_reading() { global $post; // gets the next & previous posts if they exist $previous_blog_post = get_adjacent_post(false, '', true); $next_blog_post = get_adjacent_post(false, '', false); if (get_the_title($previous_blog_post)) { $previous_title = get_the_title($previous_blog_post); } else { $previous_title = "The Previous Post"; } if (get_the_title($next_blog_post)) { $next_title = get_the_title($next_blog_post); } else { $next_title = "The Next Post"; } echo "<nav class='further-reading'>"; if ($previous_blog_post) { echo "<p class='prev'>\n \t\t<span>Previous Post</span>\n \t\t<a href='" . get_permalink($previous_blog_post) . "'>" . $previous_title . "</a>\n\t </p>"; } else { echo "<p class='prev'>\n <span>This is the oldest post</span>\n \t\t<a href='" . esc_url(home_url()) . "'>Return to Blog</a>\n \t</p>"; } if ($next_blog_post) { echo "<p class='next'>\n \t\t<span>Next Post</span>\n \t\t<a href='" . get_permalink($next_blog_post) . "'>" . $next_title . "</a>\n\t </p>"; } else { echo "<p class='next'>\n <span>This is the newest post</span>\n \t\t<a href='" . esc_url(home_url()) . "'>Return to Blog</a>\n \t </p>"; } echo "</nav>"; }
/** * Display navigation to next/previous post when applicable. * * @return void */ function digistarter_post_nav() { // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } ?> <nav class="navigation post-navigation" role="navigation"> <h3 class="screen-reader-text"> <?php __('Post navigation', TRANSLATED_TEXT_DOMAIN); ?> </h3> <div class="nav-links"> <?php previous_post_link('%link', wp_kses(_x('<span class="meta-nav prev">←</span> %title', 'Previous post link', TRANSLATED_TEXT_DOMAIN), array('span' => array('class' => array())))); ?> <?php next_post_link('%link', wp_kses(_x('%title <span class="meta-nav next">→</span>', 'Next post link', TRANSLATED_TEXT_DOMAIN), array('span' => array('class' => array())))); ?> </div><!-- .nav-links --> </nav><!-- .navigation --> <?php }
/** * Add featured image as background image to post navigation elements. * * @since Foundation Theme 0.5.0 * * @see wp_add_inline_style() */ function foundation_post_nav_background() { if (!is_single()) { return; } $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); $css = ''; if (is_attachment() && 'attachment' == $previous->post_type) { return; } if ($previous && has_post_thumbnail($previous->ID)) { $prevthumb = wp_get_attachment_image_src(get_post_thumbnail_id($previous->ID), 'post-thumbnail'); $css .= ' .post-navigation .nav-previous { background-image: url(' . esc_url($prevthumb[0]) . '); } .post-navigation .nav-previous .post-title, .post-navigation .nav-previous a:hover .post-title, .post-navigation .nav-previous .meta-nav { color: #fff; } .post-navigation .nav-previous a:before { background-color: rgba(0, 0, 0, 0.4); } '; } if ($next && has_post_thumbnail($next->ID)) { $nextthumb = wp_get_attachment_image_src(get_post_thumbnail_id($next->ID), 'post-thumbnail'); $css .= ' .post-navigation .nav-next { background-image: url(' . esc_url($nextthumb[0]) . '); border-top: 0; } .post-navigation .nav-next .post-title, .post-navigation .nav-next a:hover .post-title, .post-navigation .nav-next .meta-nav { color: #fff; } .post-navigation .nav-next a:before { background-color: rgba(0, 0, 0, 0.4); } '; } wp_add_inline_style('main-stylesheet', $css); }
/** * Display navigation to next/previous post when applicable. * * @todo Remove this function when WordPress 4.3 is released. */ function the_post_navigation() { // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } ?> <nav class="navigation post-navigation" role="navigation"> <h2 class="screen-reader-text"><?php _e('Post navigation', 'ncssm_sg'); ?> </h2> <div class="nav-links"> <?php previous_post_link('<div class="nav-previous">%link</div>', '%title'); next_post_link('<div class="nav-next">%link</div>', '%title'); ?> </div> <!-- .nav-links --> </nav><!-- .navigation --> <?php }
/** * Display navigation to next/previous post when applicable. * * @return void */ function my_simone_post_nav() { // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } ?> <nav class="navigation post-navigation" role="navigation"> <div class="post-nav-box clear"> <h1 class="screen-reader-text"><?php _e('Post navigation', 'my-simone'); ?> </h1> <div class="nav-links"> <?php previous_post_link('<div class="nav-previous"><div class="nav-indicator">' . _x('Previous Post:', 'Previous post', 'my-simone') . '</div><h1>%link</h1></div>', '%title'); next_post_link('<div class="nav-next"><div class="nav-indicator">' . _x('Next Post:', 'Next post', 'my-simone') . '</div><h1>%link</h1></div>', '%title'); ?> </div><!-- .nav-links --> </div><!-- .post-nav-box --> </nav><!-- .navigation --> <?php }
/** * Display navigation to next/previous post when applicable. */ function uncode_post_navigation($index_btn = '') { // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } $output = '<nav class="post-navigation" role="navigation"> <ul class="navigation">'; $prev = get_previous_post_link('<li class="page-prev"><span class="btn-container">%link</span></li>', '<i class="fa fa-angle-left"></i><span>' . esc_html__('Prev', 'uncode') . '</span>'); if ($prev !== '') { $output .= $prev; } else { $output .= '<li class="page-prev"><span class="btn-container"><span class="btn btn-link btn-icon-left btn-disable-hover"><i class="fa fa-angle-left"></i>' . esc_html__('Prev', 'uncode') . '</span></span></li>'; } if ($index_btn !== '') { $output .= '<li class="nav-back"><span class="btn-container">' . $index_btn . '</span></li>'; } $next = get_next_post_link('<li class="page-next"><span class="btn-container">%link</span></li>', '<span>' . esc_html__('Next', 'uncode') . '</span><i class="fa fa-angle-right"></i>'); if ($next !== '') { $output .= $next; } else { $output .= '<li class="page-next"><span class="btn-container"><span class="btn btn-link btn-icon-right btn-disable-hover">' . esc_html__('Next', 'uncode') . '<i class="fa fa-angle-right"></i></span></span></li>'; } $output .= '</ul><!-- .navigation --> </nav><!-- .post-navigation -->'; return $output; }
/** * Display navigation to next/previous post when applicable. * * @todo Remove this function when WordPress 4.3 is released. */ function wpsp_the_post_navigation() { // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); /*$post_category_ids = wp_get_post_categories( get_the_ID(), array('fields' => 'ids') ); $category_ids = array(); foreach ( $post_category_ids as $cat ) { $category = get_category( $cat ); array_push( $category_ids, $category->category_parent ); } print_r( $category_ids );*/ if (!$next && !$previous) { return; } ?> <nav class="navigation post-navigation" role="navigation"> <div class="post-nav-box clearfix"> <h1 class="screen-reader-text"><?php _e('Post navigation', 'klahan9'); ?> </h1> <div class="nav-links"> <?php previous_post_link('<div class="nav-previous"><div class="nav-indicator">' . _x('Previous Post:', 'Previous post', 'klahan9') . '</div><h1>%link</h1></div>', '%title', true); next_post_link('<div class="nav-next"><div class="nav-indicator">' . _x('Next Post:', 'Next post', 'klahan9') . '</div><h1>%link</h1></div>', '%title', true); ?> </div><!-- .nav-links --> </div><!-- .post-nav-box --> </nav><!-- .navigation --> <?php }
/** * Display navigation to next/previous post when applicable. */ function zerif_post_nav() { // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } ?> <nav class="navigation post-navigation"> <h2 class="screen-reader-text"><?php _e('Post navigation', 'zerif-lite'); ?> </h2> <div class="nav-links"> <?php previous_post_link('<div class="nav-previous">%link</div>', _x('<span class="meta-nav">←</span> %title', 'Previous post link', 'zerif-lite')); next_post_link('<div class="nav-next">%link</div>', _x('%title <span class="meta-nav">→</span>', 'Next post link', 'zerif-lite')); ?> </div><!-- .nav-links --> </nav><!-- .navigation --> <?php }
function flat_post_nav() { global $post; $previous = is_attachment() ? get_post($post->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } ?> <nav class="navigation post-navigation" role="navigation"> <h1 class="screen-reader-text"><?php _e('Post navigation', 'flat'); ?> </h1> <div class="nav-links"> <?php previous_post_link('%link', _x('<span class="meta-nav">←</span> %title', 'Previous post link', 'flat')); ?> <?php next_post_link('%link', _x('%title <span class="meta-nav">→</span>', 'Next post link', 'flat')); ?> </div> </nav> <?php }
/** * Display navigation to next/previous post when applicable. */ function oceanic_post_nav() { // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } ?> <nav class="navigation post-navigation" role="navigation"> <h1 class="screen-reader-text"><?php _e('Post navigation', 'oceanic'); ?> </h1> <div class="nav-links"> <?php $slider_cats = get_theme_mod('oceanic-slider-cats', false); $slider_cat_ids = array(); if ($slider_cats) { $slider_cats = explode(',', esc_html($slider_cats)); for ($i = 0; $i < count($slider_cats); ++$i) { $cat_id = get_cat_ID($slider_cats[$i]); if ($cat_id > 0) { $slider_cat_ids[$i] = $cat_id; } } } previous_post_link('<div class="nav-previous">%link</div>', _x('<span class="meta-nav">←</span> %title', 'Previous post link', 'oceanic'), false, $slider_cat_ids); next_post_link('<div class="nav-next">%link</div>', _x('%title <span class="meta-nav">→</span>', 'Next post link', 'oceanic'), false, $slider_cat_ids); ?> </div><!-- .nav-links --> </nav><!-- .navigation --> <?php }
/** * Display navigation to next/previous post when applicable. * * @todo Remove this function when WordPress 4.3 is released. */ function tutannet_post_navigation() { $trans_next = of_get_option('trans_next_article'); if (empty($trans_next)) { $trans_next = __('Next article', 'tutannet'); } $trans_prev = of_get_option('trans_previous_article'); if (empty($trans_prev)) { $trans_prev = __('Previous article', 'tutannet'); } // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } ?> <nav class="navigation post-navigation clearfix" role="navigation"> <h2 class="screen-reader-text"><?php _e('Post navigation', 'tutannet'); ?> </h2> <div class="nav-links"> <?php previous_post_link('<div class="nav-previous"><div class="link-caption"><i class="fa fa-angle-left"></i>' . esc_attr($trans_prev) . '</div>%link</div>', '%title'); next_post_link('<div class="nav-next"><div class="link-caption">' . esc_attr($trans_next) . '<i class="fa fa-angle-right"></i></div>%link</div>', '%title'); ?> </div><!-- .nav-links --> </nav><!-- .navigation --> <?php }
/** * Display navigation to next/previous post when applicable. * * @deprecated 2.1 Use the_post_navigation() */ function blue_planet_post_nav() { // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } ?> <nav class="navigation post-navigation" role="navigation"> <h1 class="screen-reader-text"><?php esc_html_e('Post navigation', 'blue-planet'); ?> </h1> <div class="nav-links"> <?php previous_post_link('%link', '<span class="meta-nav">←</span> %title'); ?> <?php next_post_link('%link', '%title <span class="meta-nav">→</span>'); ?> </div><!-- .nav-links --> </nav><!-- .navigation --> <?php }
/** * Display navigation to next/previous post when applicable. * * @return void */ function homeword_post_nav() { // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } ?> <nav class="navigation post-navigation" role="navigation"> <h1 class="assistive-text"><?php _e('Post navigation', 'homeword'); ?> </h1> <div class="nav-links"> <?php previous_post_link('%link', _x('<span class="meta-nav">←</span> %title', 'Previous post link', 'homeword')); ?> <?php next_post_link('%link', _x('%title <span class="meta-nav">→</span>', 'Next post link', 'homeword')); ?> </div><!-- .nav-links --> </nav><!-- .navigation --> <?php }
/** * Display navigation to next/previous post when applicable. * * @return void */ function writ_post_nav() { // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } ?> <nav class="navigation post-navigation" role="navigation"> <h1 class="screen-reader-text"><?php _e('Post navigation', 'writ'); ?> </h1> <div class="nav-links"> <?php previous_post_link('<div class="nav-previous">%link</div>', '<div class="arrow">' . _x('←', 'Previous post link', 'writ') . '</div><div class="link">%title</div>'); ?> <?php next_post_link('<div class="nav-next">%link</div>', '<div class="arrow">' . _x('→', 'Next post link', 'writ') . '</div><div class="link">%title</div>'); ?> </div><!-- .nav-links --> </nav><!-- .navigation --> <?php }
function xxx2($content) { //var_dump(get_adjacent_post()); $adjPage = get_adjacent_post(); $content .= '<a href="' . $adjPage->guid . ' ">NEXT page</a>'; return $content; }
/** * Display navigation to next/previous post when applicable. * * @return void */ function apostrophe_post_nav() { // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } ?> <nav class="navigation post-navigation" role="navigation"> <h1 class="screen-reader-text"><?php esc_html_e('Post navigation', 'apostrophe'); ?> </h1> <div class="nav-links"> <div class="nav-previous"> <?php previous_post_link('%link', '<span class="meta-nav">' . _x('Previous', 'Previous post link', 'apostrophe') . '</span> <span class="apostrophe-post-title">%title</span>'); ?> </div> <div class="nav-next"> <?php next_post_link('%link', '<span class="meta-nav">' . _x('Next', 'Next post link', 'apostrophe') . '</span> <span class="apostrophe-post-title">%title</span>'); ?> </div> </div><!-- .nav-links --> </nav><!-- .navigation --> <?php }
public function renderPrevReferenceLink() { $adjacent = get_adjacent_post(false, "", true); if (KT::issetAndNotEmpty($adjacent)) { $url = get_permalink($adjacent->ID); echo "<a href=\"{$url}\" title=\"Předchozí naše práce\" class=\"prev\">Předchozí reference</a>"; } }
function hepouf_content_nav($nav_id) { global $wp_query, $post; // Don't print empty markup on single pages if there's nowhere to navigate. if (is_single()) { $previous = is_attachment() ? get_post($post->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } } // Don't print empty markup in archives if there's only one page. if ($wp_query->max_num_pages < 2 && (is_home() || is_archive() || is_search())) { return; } $nav_class = is_single() ? 'post-navigation' : 'paging-navigation'; ?> <nav role="navigation" id="<?php echo esc_attr($nav_id); ?> " class="<?php echo $nav_class; ?> "> <?php if (is_single()) { // navigation links for single posts ?> <?php previous_post_link('<div class="nav-previous">%link</div>', '<span class="meta-nav">' . _x('<i class="ico-left-open"></i>', 'Previous post link', 'athemes') . '</span> %title'); ?> <?php next_post_link('<div class="nav-next">%link</div>', '%title <span class="meta-nav">' . _x('<i class="ico-right-open"></i>', 'Next post link', 'athemes') . '</span>'); ?> <?php } elseif ($wp_query->max_num_pages > 1 && (is_home() || is_archive() || is_search())) { // navigation links for home, archive, and search pages ?> <?php wp_pagenavi(); ?> <?php } ?> </nav><!-- #<?php echo esc_html($nav_id); ?> --> <?php }
function next_post_id($data, $post, $request) { $_data = $data->data; $next = get_adjacent_post(false, '', true); if ($next != get_permalink($data['id'])) { $_data = $next; } // $data->data = $_data; return $_data; }
/** * Display navigation to next/previous post when applicable. */ function eryn_post_nav() { // Don't print empty markup if there's nowhere to navigate. $previous = is_attachment() ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); $next = get_adjacent_post(false, '', false); if (!$next && !$previous) { return; } ?> <nav class="navigation post-navigation" role="navigation"> <h1 class="screen-reader-text"><?php _e('Post navigation', 'eryn'); ?> </h1> <div class="nav-links"> <?php $next_post = get_next_post(); $prev_post = get_previous_post(); if (!empty($prev_post)) { ?> <div class="nav-previous"> <a href="<?php echo get_permalink($prev_post->ID); ?> "> <span class="meta-nav">←</span> <?php _e('Previous Post', 'eryn'); ?> </a> </div> <?php } ?> <?php if (!empty($next_post)) { ?> <div class="nav-next"> <a href="<?php echo get_permalink($next_post->ID); ?> "><?php _e('Next Post', 'eryn'); ?> <span class="meta-nav">→</span> </a> </div> <?php } ?> </div><!-- .nav-links --> </nav><!-- .navigation --> <?php }