function NextAndPreviousLinks() { global $wp_query; $previous_post = get_previous_post(); $next_post = get_next_post(); $prev_id = empty($previous_post) ? null : $previous_post->ID; $next_id = empty($next_post) ? null : $next_post->ID; ?> <?php if (!empty($prev_id) && !empty($next_id)) { ?> <nav class="post-links post-links--both" role="navigation"> <?php Article_PreviewThumbnail($prev_id); ?> <?php Article_PreviewThumbnail($next_id); ?> </nav> <?php } elseif (!empty($prev_id)) { ?> <nav class="post-links post-links--single" role="navigation"> <?php Article_PreviewThumbnail($prev_id); ?> </nav> <?php } elseif (!empty($next_id)) { ?> <nav class="post-links post-links--single" role="navigation"> <?php Article_PreviewThumbnail($next_id); ?> </nav> <?php } }
function link_rel_prev_next() { // <link rel="home" title="Home" href="http://url/of/home/page" /> $prev_url = ''; $next_url = ''; if (!is_singular()) { $prev_url = get_previous_posts_page_link(); $next_url = get_next_posts_page_link(); if (!empty($prev_url)) { printf('<link rel="prev" href="%s" />' . "\n", $prev_url); } if (!empty($next_url)) { printf('<link rel="next" href="%s" />' . "\n", $next_url); } } else { global $post; // $up_post = get_post($post->post_parent); // // $prev_post = get_previous_post(); // if ( !empty( $prev_post->ID)) // printf( '<link rel="prev" title="%s" href="%s" />' . "\n", $prev_post->post_title , get_permalink($prev_post->ID) ); // // $next_post = get_next_post(); // if ( !empty($next_post->ID)) // printf( '<link rel="next" title="%s" href="%s" />' . "\n", $prev_post->post_title , get_permalink($next_post->ID) ); safe_link_rel('next', get_post($post->parent)); safe_link_rel('prev', get_previous_post()); safe_link_rel('next', get_next_post()); } }
function load_settings() { $options = $this->get_wp_post_navigation_options(); $navi = $options['nav_within_cat'] == "1" ? true : false; $next_post = get_next_post($navi); $pre_post = get_previous_post($navi); if ($options['navi_img'] != "1") { if ($options['is_custom'] != "1") { $pre_navigation = $pre_post->ID != "" ? '<a href="' . get_permalink($pre_post->ID) . '">' . $pre_post->post_title . '</a>' : ''; $next_navigation = $next_post->ID != "" ? '<a href="' . get_permalink($next_post->ID) . '">' . $next_post->post_title . '</a>' : ''; } else { $pre_navigation = $pre_post->ID != "" ? '<a href="' . get_permalink($pre_post->ID) . '">' . $options['custom_pre'] . '</a>' : ''; $next_navigation = $next_post->ID != "" ? '<a href="' . get_permalink($next_post->ID) . '">' . $options['custom_next'] . '</a>' : ''; } } else { $pre_navigation = $pre_post->ID != "" ? '<a href="' . get_permalink($pre_post->ID) . '"><img src="' . $options['pre_img_link'] . '" /></a>' : ''; $next_navigation = $next_post->ID != "" ? '<a href="' . get_permalink($next_post->ID) . '"><img src="' . $options['next_img_link'] . '" /></a>' : ''; } $img = $options['navi_img'] == "1" ? "-1" : ''; $this->config["is_reversed"] = $options['is_reversed']; $this->config["hasImage"] = $img; $nex = $this->config["is_reversed"] == "1" ? $next_navigation : $pre_navigation; $pre = $this->config["is_reversed"] == "1" ? $pre_navigation : $next_navigation; $this->config["prePost"] = $pre; $this->config["nextPost"] = $nex; $this->config["is_active"] = $options['is_active']; $this->config["position"] = $options['position']; }
function prev_next_post_link() { $prev_post = get_previous_post(); $next_post = get_next_post(); ?> <div id="post_nav"> <?php if ($prev_post) { ?> <div id="prev_post"> <?php previous_post_link('%link', '⇐%title', false); ?> </div> <?php } ?> <?php if ($next_post) { ?> <div id="next_post"> <?php next_post_link('%link', '%title⇒', false); ?> </div> <?php } ?> </div> <?php }
function beans_child_previous_text_post_navigation() { if ($post = get_previous_post()) { $text = $post->post_title; } return '<strong class="uk-display-block">Previous post </strong>' . $text; }
function zp_get_portfolio_sidebar() { global $post; // retrieve post meta values $button_label = get_post_meta($post->ID, 'button_label', true); $button_link = get_post_meta($post->ID, 'button_link', true); $date_label = get_post_meta($post->ID, 'date_label', true); $date_value = get_post_meta($post->ID, 'date_value', true); $client_label = get_post_meta($post->ID, 'client_label', true); $client_value = get_post_meta($post->ID, 'client_value', true); $category_label = get_post_meta($post->ID, 'category_label', true); $video_link = get_post_meta($post->ID, 'video_link', true); $output = ''; if (have_posts()) { while (have_posts()) { the_post(); $output .= '<div class="col-md-12 single_portfolio_sidebar">'; if ($button_link) { $output .= '<div class="single_portfolio_section single_portfolio_button col-m-12"><a class="btn btn-hg btn-primary " href="' . $button_link . '">' . $button_label . '</a></div>'; } $output .= '<div class="single_portfolio_section single_portfolio_content col-m-12">' . get_the_content() . '</div>'; if ($date_value || $client_value || $category_label) { $output .= '<div class="single_portfolio_section single_portfolio_meta col-m-12">'; if ($date_value) { $output .= '<div class="meta_value date_meta"><span class="meta_label">' . $date_label . '</span>' . $date_value . '</div>'; } if ($client_value) { $output .= '<div class="meta_value client_meta"><span class="meta_label">' . $client_label . '</span>' . $client_value . '</div>'; } // retrieve portfolio category if ($category_label) { $output .= '<div class="meta_value category_meta"><span class="meta_label">' . $category_label . '</span>'; $categories = wp_get_post_terms($post->ID, 'portfolio_category'); foreach ($categories as $category) { $output .= $category->name . ' '; } $output .= '</div>'; } $output .= '</div>'; } $output .= '<div class="single_portfolio_section single_portfolio_nav col-m-12">'; $prev_post = get_previous_post(); if (!empty($prev_post)) { $output .= '<div class="single_nav_prev"><a href="' . get_permalink($prev_post->ID) . '" class="btn btn-sm btn-primary">' . __('previous', 'start') . '</a></div>'; } $next_post = get_next_post(); if (!empty($next_post)) { $output .= '<div class="single_nav_next inline"><a href="' . get_permalink($next_post->ID) . '" class="btn btn-sm btn-primary">' . __('next', 'start') . '</a></div>'; } $output .= '</div>'; $output .= '</div>'; } } genesis_structural_wrap('sidebar'); do_action('genesis_before_sidebar_widget_area'); echo $output; do_action('genesis_after_sidebar_widget_area'); genesis_structural_wrap('sidebar', 'close'); }
/** * Возвращает массив данных о записи * @return array|bool|null|\WP_Post */ function getSinglePost() { global $post; $result = false; if (have_posts()) { the_post(); $category = get_the_category($post->ID); if (is_array($category) && count($category) > 0) { $post->category = $category; // Получаем произвольные поля $post->fields = get_fields($post->ID); $post->fields['detail_image'] = isset($post->fields['detail_image']) && !empty($post->fields['detail_image']) ? $post->fields['detail_image'] : Config::DEFAULT_IMAGE_SRC; // Получаем текст поста $content = get_post_field('post_content', $post->ID); $post->contentParts = get_extended($content); // Метки $post->terms = wp_get_post_tags($post->ID); if (isset($post->fields['photos']) && is_array($post->fields['photos']) && count($post->fields['photos']) > 0) { foreach ($post->fields['photos'] as &$photo) { $photo->fields = get_fields($photo->ID); $photo->terms = wp_get_post_tags($photo->ID); $post->fields['detail_image'] = isset($post->fields['detail_image']) && !empty($post->fields['detail_image']) ? $post->fields['detail_image'] : Config::DEFAULT_IMAGE_SRC; } } $result = $post; // Читайте далее $readMorePosts = array(); // Получаем предыдущий пост для блока читайте далее $previousPost = get_previous_post(true); $isHavePosts = is_object($previousPost) ? true : false; $readMorePosts[] = $previousPost; // Получаем 2 последующих поста для блока читайте далее $query = new \WP_Query(array('posts_per_page' => 2, 'category_name' => $category[0]->slug, 'orderby' => 'post_date', 'order' => 'DESC', 'post_status' => 'publish', 'post__not_in' => array($post->ID), 'date_query' => array(array('after' => $post->post_date, 'inclusive' => true)))); while ($query->have_posts()) { $query->the_post(); $readMorePosts[] = $post; } wp_reset_postdata(); $result->readMorePosts = array(); if ($isHavePosts || count($readMorePosts) > 2) { $numperReadMorePosts = 0; foreach ($readMorePosts as &$post) { if (is_object($post) && $numperReadMorePosts < 2) { // Получаем прикрепленное изображение для поста в блоке Читайте далее $post->fields = get_fields($post->ID); // Получаем текст для поста в блоке Читайте далее $content = get_post_field('post_content', $post->ID); $post->contentParts = get_extended($content); $post->terms = wp_get_post_tags($post->ID); $post->permalink = get_permalink($post->ID); $result->readMorePosts[] = $post; } } } } } return $result; }
function filter_previous_post_link($link) { global $post; $post = get_post($post_id); $previous_post = get_previous_post(); $title = $previous_post->post_title; $link = str_replace("rel=", 'class="previous" rel=', $link); return $link; }
/** * 個別ページ用のコンテンツフッターを表示 */ function singular_content_footer($is_print = false) { $html = ""; //広告 $html .= '<div class="ad-label lined">広告</div>'; $html .= \getAdCode('rectangle'); //次の記事 $next = \get_next_post(true); if ($next) { $next_post = new LinkCard($next); $next_code = $next_post->getCode("article_footer_link", "next-post"); $next_html = <<<EOD <div class="link-card-container"> \t<h5>次の記事</h5> \t\t{$next_code} </div> EOD; } else { $next_html = ""; } //前の記事 $prev = \get_previous_post(true); if ($prev) { $prev_post = new LinkCard($prev); $prev_code = $prev_post->getCode('article_footer_link', 'prev-post'); $prev_html = <<<EOD <div class="link-card-container"> \t<h5>前の記事</h5> \t{$prev_code} </div> EOD; } else { $prev_html = ""; } $nav = $next || $prev ? $next_html . $prev_html : " "; $ad = '<div class="ad-label lined">広告</div>'; $ad .= \getAdCode('scraper'); $html .= <<<EOD <footer class="content pure-g"> \t<div class="pure-u-1 pure-u-sm-3-4 pure-u-md-17-24 pure-u-lg-5-8"> \t\t<div class="content-footer"> \t\t\t{$nav} \t\t</div> \t</div> \t<div class="pure-u-1 pure-u-sm-1-4 pure-u-md-7-24 pure-u-lg-3-8"> \t{$ad} \t</div> </footer> EOD; if ($is_print) { echo $html; } else { return $html; } }
function wptouch_theme_get_previous_post_link() { $prev_post = get_previous_post(); if ($prev_post) { $prev_post = get_previous_post(false); $prev_url = get_permalink($prev_post->ID); // echo '<a href="#" rel="' . $prev_url . '" class="nav-back ajax-link">' . __( "Back", "wptouch-pro" ) . '</a>'; <- playing with ajax echo '<a href="' . $prev_url . '" class="nav-back ajax-link">' . __("Back", "wptouch-pro") . '</a>'; } }
/** * 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 }
/** * Latest Edition Page Template JSON API Response Modifications * * @param $response The JSON API Response Object * * @return $response Update JSON API Response Object */ function tls_latest_edition_page_json_api_encode($response) { if (isset($response['page_template_slug']) && $response['page_template_slug'] == "template-latest-edition.php" || isset($response['post']) && $response['post']->type == 'tls_editions') { if (isset($response['page_template_slug']) && $response['page_template_slug'] == "template-latest-edition.php") { $latest_edition = new WP_Query(array('post_type' => 'tls_editions', 'post_status' => 'publish', 'posts_per_page' => 1, 'orderby ' => 'date')); wp_reset_query(); } else { if (isset($response['post']) && $response['post']->type == 'tls_editions') { $latest_edition = new WP_Query(array('p' => $response['post']->id, 'post_type' => 'tls_editions', 'post_status' => 'publish', 'posts_per_page' => 1, 'orderby ' => 'date')); wp_reset_query(); } } $latest_edition = $latest_edition->posts[0]; global $post; $oldGlobal = $post; $post = get_post($latest_edition->ID); $response['latest_edition'] = array('id' => $latest_edition->ID, 'title' => get_the_title($latest_edition->ID), 'url' => get_permalink($latest_edition->ID)); if (get_previous_post()) { $previousPost = get_previous_post(); $response['latest_edition']['previous_post_info'] = array('previous' => $previousPost, 'id' => $previousPost->ID, 'title' => get_the_title($previousPost->ID), 'url' => get_permalink($previousPost->ID)); } if (get_next_post()) { $nextPost = get_next_post(); $response['latest_edition']['next_post_info'] = array('next' => $nextPost, 'id' => $nextPost->ID, 'title' => get_the_title($nextPost->ID), 'url' => get_permalink($nextPost->ID)); } $latest_edition_articles = get_fields($latest_edition->ID); $response['latest_edition']['content']['featured'] = array('issue_no' => $latest_edition_articles['edition_number'], 'image_url' => $latest_edition_articles['feautured_image']['url']); $response['latest_edition']['content']['public']['title'] = __('Public content', 'tls'); $public_articles = get_field('public_articles', $latest_edition->ID); foreach ($public_articles as $public_article) { $section = wp_get_post_terms($public_article->ID, 'article_section'); $postAuthor = get_field('field_54e4d3b1b0094', $public_article->ID); $response['latest_edition']['content']['public']['articles'][$public_article->post_name] = array('id' => $public_article->ID, 'author' => $postAuthor, 'title' => get_the_title($public_article->ID), 'section' => array('name' => $section[0]->name, 'link' => get_term_link($section[0]->term_id, $section[0]->taxonomy)), 'url' => get_permalink($public_article->ID)); } $response['latest_edition']['content']['regulars']['title'] = __('Regular Features', 'tls'); $regular_articles = get_field('edition_regular_articles', $latest_edition->ID); foreach ($regular_articles as $regular_article) { $postAuthor = get_field('field_54e4d3b1b0094', $regular_article->ID); $section = wp_get_post_terms($regular_article->ID, 'article_section'); $article_section = wp_get_post_terms($regular_article->ID, 'article_visibility'); $response['latest_edition']['content']['regulars']['articles'][$regular_article->post_name] = array('type' => 'article', 'id' => $regular_article->ID, 'author' => $postAuthor, 'title' => get_the_title($regular_article->ID), 'section' => array('name' => $section[0]->name, 'link' => get_term_link($section[0]->term_id, $section[0]->taxonomy)), 'taxonomy_article_visibility' => $article_section, 'url' => get_permalink($regular_article->ID)); } $response['latest_edition']['content']['subscribers']['title'] = __('Subscriber Exclusive'); $subscriber_only_articles = get_field('subscriber_only_articles', $latest_edition->ID); foreach ($subscriber_only_articles as $subscriber_only_article) { $section = wp_get_post_terms($subscriber_only_article->ID, 'article_section'); $postAuthor = get_field('field_54e4d3b1b0094', $subscriber_only_article->ID); $response['latest_edition']['content']['subscribers']['articles'][$section[0]->name]['section']->name = $section[0]->name; $response['latest_edition']['content']['subscribers']['articles'][$section[0]->name]['section']->link = get_term_link($section[0]->term_id, $section[0]->taxonomy); $response['latest_edition']['content']['subscribers']['articles'][$section[0]->name]['posts'][$subscriber_only_article->post_name] = array('id' => $subscriber_only_article->ID, 'author' => $postAuthor, 'title' => get_the_title($subscriber_only_article->ID), 'section' => array('name' => $section[0]->name, 'link' => get_term_link($section[0]->term_id, $section[0]->taxonomy)), 'url' => get_permalink($subscriber_only_article->ID)); } } return $response; }
function previousPortfolioLink() { if (get_previous_post()) { previous_post_link('%link', getPostLinkIcon('left')); } else { $args = array('post_type' => 'portfolio', 'posts_per_page' => '1', 'order' => 'DESC'); $first = new WP_Query($args); $first->the_post(); echo '<a rel="prev" href="' . get_permalink() . '">' . getPostLinkIcon('left') . '</a>'; wp_reset_query(); } }
function add_title_to_previous_post_link($link) { global $post; $post = get_post($post->ID); $previous_post = get_previous_post(); if ($previous_post) { $title = $previous_post->post_title; } else { $title = ''; } $link = str_replace("rel=", " title='" . $title . "' rel=", $link); return $link; }
{ ?> <style type="text/css"> #headimg { width: <?php echo HEADER_IMAGE_WIDTH; ?> px; height: <?php echo HEADER_IMAGE_HEIGHT; ?> px; } </style><?php
public function render() { $this->entries = array(); if (is_attachment()) { } elseif (is_single()) { $this->entries = array('previous' => get_previous_post(), 'next' => get_next_post()); // } elseif (is_archive() || is_search()) { } else { $this->type = 'numerical'; $this->get_pagenav_num(); } return $this->entries; }
function previous_post_link_short($format = '« %link', $link = '%title', $in_same_cat = false, $excluded_categories = '', $length = 32) { if (is_attachment()) { $post =& get_post($GLOBALS['post']->post_parent); } else { $post = get_previous_post($in_same_cat, $excluded_categories); } if (!$post) { return; } $title = apply_filters('the_title', $post->post_title, $post); $short_title = create_short_title($title, $length); $string = '<a href="' . get_permalink($post->ID) . '"' . ' title="' . $title . '">'; $link = str_replace('%title', $short_title, $link); $link = $pre . $string . $link . '</a>'; $format = str_replace('%link', $link, $format); echo $format; }
function get_next_previous_port_id($post_id, $next_or_prev) { // Get a global post reference since get_adjacent_post() references it global $post; // Store the existing post object for later so we don't lose it $oldGlobal = $post; // Get the post object for the specified post and place it in the global variable $post = get_post($post_id); // Get the post object for the previous post $previous_post = $next_or_prev == "prev" ? get_previous_post() : get_next_post(); // Reset our global object $post = $oldGlobal; if ('' == $previous_post) { $port = get_posts(array('post_type' => 'portfolio', 'order' => $next_or_prev == "prev" ? 'DESC' : 'ASC', 'posts_per_page' => 1)); return $port[0]->ID; } return $previous_post->ID; }
function previous_post($format = '%', $previous = 'previous post: ', $title = 'yes', $in_same_cat = 'no', $limitprev = 1, $excluded_categories = '') { if (empty($in_same_cat) || 'no' == $in_same_cat) { $in_same_cat = false; } else { $in_same_cat = true; } $post = get_previous_post($in_same_cat, $excluded_categories); if (!$post) { return; } $string = '<a href="' . get_permalink($post->ID) . '">' . $previous; if ('yes' == $title) { $string .= apply_filters('the_title', $post->post_title, $post); } $string .= '</a>'; $format = str_replace('%', $string, $format); echo $format; }
function micronav() { wp_reset_postdata(); $is_post = is_single() && !is_attachment() && !wallow_is_allcat(); $is_archive = (is_archive() || is_search() || is_home()) && !wallow_is_allcat(); if ($is_post) { $next = get_next_post() ? '<a title="' . esc_attr(sprintf(__('Next Post', 'wallow') . ': %s', get_the_title(get_next_post()))) . '" href="' . esc_url(get_permalink(get_next_post())) . '"> </a>' : ''; $prev = get_previous_post() ? '<a title="' . esc_attr(sprintf(__('Previous Post', 'wallow') . ': %s', get_the_title(get_previous_post()))) . '" href="' . esc_url(get_permalink(get_previous_post())) . '"> </a>' : ''; } elseif ($is_archive) { $prev = get_next_posts_link() ? get_next_posts_link(' ') : ''; $next = get_previous_posts_link() ? get_previous_posts_link(' ') : ''; } else { $next = ''; $prev = ''; } ?> <div id="micronav"> <div class="next archive-navigation"><?php echo $next; ?> </div> <div class="prev archive-navigation"><?php echo $prev; ?> </div> <div class="home"><a title="<?php esc_attr_e('Home', 'wallow'); ?> " href="<?php echo esc_url(home_url()); ?> "> </a></div> <div class="up"><a title="<?php esc_attr_e('Top', 'wallow'); ?> " href="#"> </a></div> <div class="down"><a title="<?php esc_attr_e('Bottom', 'wallow'); ?> " href="#credits"> </a></div> </div> <?php }
/** * Outputs links to the next and previous posts. * * WordPress has this functionality, but the built-in formatting isn't * to Tarski's tastes, so this function builds its own. * * @since 1.2 * * @uses previous_post_link * @uses next_post_link * * @return string */ function tarski_next_prev_posts() { if (is_single()) { $prev_post = get_previous_post(); $next_post = get_next_post(); if ($prev_post || $next_post) { echo '<p class="primary-span articlenav">'; if ($prev_post) { echo '<span class="previous-entry">'; previous_post_link('%link', '‹ %title'); echo '</span>'; if ($next_post) { echo ' <span class="separator"> • </span> '; } } if ($next_post) { echo '<span class="next-entry">'; next_post_link('%link', '%title ›'); echo '</span>'; } echo "</p>\n"; } } }
next_post_link('%link', __('Next', 'circleflip')); ?> </div> <?php } else { ?> <div class="nextPost right disabled"><a><?php esc_html_e('Next', 'circleflip'); ?> </a></div> <?php } ?> <?php if (get_previous_post()) { ?> <div class="prevPost right"><?php previous_post_link('%link', __('Prev', 'circleflip')); ?> </div> <?php } else { ?> <div class="prevPost right disabled"><a><?php esc_html_e('Prev', 'circleflip'); ?> </a></div> <?php } ?>
get_template_part('related-entries'); ?> </div><!-- #related-entries --> <?php if (is_ads_under_relations() || wp_is_mobile() && is_ads_in_content() || !preg_match('/<h2.*?>/i', get_the_content()) && !is_ads_sidebar_top()) { get_template_part('ad'); } ?> <!-- post navigation --> <div class="navigation"> <?php $prev_post = get_previous_post(); if ($prev_post) { ?> <div class="prev"><?php previous_post_link('%link', '<i class="fa fa-arrow-left fa-2x pull-left"></i>' . $prev_post->post_title); ?> </div> <?php } $next_post = get_next_post(); if ($next_post) { ?> <div class="next"><?php next_post_link('%link', '<i class="fa fa-arrow-right fa-2x pull-left"></i>' . $next_post->post_title); ?> </div>
function zm_previous_post() { global $post; // Retrieve next post link that is adjacent to current post. $prevPost = get_previous_post(false); // Check to make sure we have a previous post if (!empty($prevPost)) { if (function_exists('get_the_post_thumbnail')) { $prevthumbnail = get_the_post_thumbnail($prevPost->ID, 'thumbnail'); } echo '<div class="image">'; if (isset($prevthumbnail) && !empty($prevthumbnail)) { previous_post_link('%link', "{$prevthumbnail}", false); } echo '</div>'; // Probally a better way to do this, but f-it, it works print '<div class="content">'; print '<span class="title">'; previous_post_link('%link', '%title'); print '</span>'; // Get our list of catgeories if (get_the_category($prevPost->ID)) { // Returns an array of objects $categories = get_the_category($prevPost->ID); $catTotal = count($categories); $i = 0; print 'Category '; for ($i; $i < $catTotal; $i++) { print '<a href="' . get_category_link($categories[$i]->cat_ID) . '">' . $categories[$i]->cat_name . '</a> '; } print '<span class="posted-on">Posted on '; the_modified_time('m/d/ Y'); print '</span>'; } else { $category = 'no'; } print '</div>'; } }
<?php if (is_single()) { ?> <div id="single-post-nav"> <ul class="pager"> <?php $trunc_limit = 30; ?> <?php if ('' != get_previous_post()) { ?> <li class="previous"> <?php previous_post_link('<span class="previous-page">%link</span>', __('<i class="fa fa-caret-left"></i>', 'bones') . ' ' . brew_truncate_text(get_previous_post()->post_title, $trunc_limit)); ?> </li> <?php } // end if ?> <?php if ('' != get_next_post()) { ?> <li class="next"> <?php next_post_link('<span class="no-previous-page-link next-page">%link</span>', ' ' . brew_truncate_text(get_next_post()->post_title, $trunc_limit) . ' ' . __('<i class="fa fa-caret-right"></i>', 'bones')); ?> </li>
?> <?php if (function_exists('get_the_tags')) { the_tags('<br />' . __('Tags', 'wptouch') . ': ', ', ', ''); } ?> </div> <ul id="post-options"> <?php $prevPost = get_previous_post(); if ($prevPost) { ?> <li><a href="<?php $prevPost = get_previous_post(false); $prevURL = get_permalink($prevPost->ID); echo $prevURL; ?> " id="oprev"></a></li> <?php } ?> <li><a href="mailto:?subject=<?php bloginfo('name'); ?> - <?php the_title(); ?> &body=<?php _e("Check out this post:", "wptouch");
function om_get_previous_post($in_same_cat = false, $excluded_categories = '', $taxonomy = 'category', $orderby = 'post_date') { if ((!$in_same_cat || $taxonomy == 'category') && $orderby == 'post_date') { // use standard function for standard parameters - safer return get_previous_post($in_same_cat, $excluded_categories); } else { return om_get_adjacent_post($in_same_cat, $excluded_categories, true, $taxonomy, $orderby); } }
function sf_post_split_heading_buttons() { global $sf_options, $sf_sidebar_config; $blog_page = __($sf_options['blog_page'], 'swiftframework'); $prev_post = get_next_post(); $next_post = get_previous_post(); $has_both = false; if (!empty($next_post) && !empty($prev_post)) { $has_both = true; } ?> <?php if ($blog_page != "") { ?> <div class="blog-button"> <a class="sf-button medium white rounded bordered" href="<?php echo get_permalink($blog_page); ?> "> <i class="fa-long-arrow-left"></i> <span class="text"><?php _e("View all posts", "swiftframework"); ?> </span> </a> </div> <?php } ?> <?php if (!empty($next_post) || !empty($prev_post)) { ?> <?php if ($has_both) { ?> <div class="post-pagination prev-next"> <?php } else { ?> <div class="post-pagination"> <?php } ?> <?php if (!empty($next_post)) { $author_id = $next_post->post_author; $author_name = get_the_author_meta('display_name', $author_id); $author_url = get_author_posts_url($author_id); $post_date = get_the_date(); $post_date_str = get_the_date('Y-m-d'); $post_categories = get_the_category_list(', ', '', $next_post->ID); ?> <a class="next-article" href="<?php echo get_permalink($next_post->ID); ?> "> <h4><?php _e("Older", 'swiftframework'); ?> </h4> <h3><?php echo esc_attr($next_post->post_title); ?> </h3> </a> <?php } ?> <?php if (!empty($prev_post)) { $author_id = $prev_post->post_author; $author_name = get_the_author_meta('display_name', $author_id); $author_url = get_author_posts_url($author_id); $post_date = get_the_date(); $post_date_str = get_the_date('Y-m-d'); $post_categories = get_the_category_list(', ', '', $prev_post->ID); ?> <a class="prev-article" href="<?php echo get_permalink($prev_post->ID); ?> "> <h4><?php _e("Newer", 'swiftframework'); ?> </h4> <h3><?php echo esc_attr($prev_post->post_title); ?> </h3> </a> <?php } ?> </div> <?php } }
function thesis_prev_next_posts() { global $thesis_site; if (is_single() && $thesis_site->display['posts']['nav']) { $previous = get_previous_post(); $next = get_next_post(); if ($previous || $next) { echo "\t\t\t\t\t<div class=\"prev_next post_nav\">\n"; if ($previous) { if ($previous && $next) { $add_class = ' class="previous"'; } echo "\t\t\t\t\t\t<p{$add_class}>" . __('Previous post:', 'thesis') . ' '; previous_post_link('%link', '%title'); echo "</p>\n"; } if ($next) { echo "\t\t\t\t\t\t<p>" . __('Next post:', 'thesis') . ' '; next_post_link('%link', '%title'); echo "</p>\n"; } echo "\t\t\t\t\t</div>\n"; } } }
function get_next_prev_posts() { if (!$this->is_single) { return; } if (td_util::get_option('tds_show_next_prev') == 'hide') { return; } $buffy = ''; $next_post = get_next_post(); $prev_post = get_previous_post(); if (!empty($next_post) or !empty($prev_post)) { $buffy .= '<div class="td-block-row td-post-next-prev">'; if (!empty($prev_post)) { $buffy .= '<div class="td-block-span6 td-post-prev-post">'; $buffy .= '<div class="td-post-next-prev-content"><span>' . __td('Previous article', TD_THEME_NAME) . '</span>'; $buffy .= '<a href="' . esc_url(get_permalink($prev_post->ID)) . '">' . $prev_post->post_title . '</a>'; $buffy .= '</div>'; $buffy .= '</div>'; } else { $buffy .= '<div class="td-block-span6 td-post-prev-post">'; $buffy .= '</div>'; } $buffy .= '<div class="td-next-prev-separator"></div>'; if (!empty($next_post)) { $buffy .= '<div class="td-block-span6 td-post-next-post">'; $buffy .= '<div class="td-post-next-prev-content"><span>' . __td('Next article', TD_THEME_NAME) . '</span>'; $buffy .= '<a href="' . esc_url(get_permalink($next_post->ID)) . '">' . $next_post->post_title . '</a>'; $buffy .= '</div>'; $buffy .= '</div>'; } $buffy .= '</div>'; //end fluid row } return $buffy; }