本文整理汇总了PHP中get_previous_post函数的典型用法代码示例。如果您正苦于以下问题:PHP get_previous_post函数的具体用法?PHP get_previous_post怎么用?PHP get_previous_post使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_previous_post函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: NextAndPreviousLinks
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
}
}
开发者ID:gios-asu,项目名称:bemmy-wordpress-theme,代码行数:38,代码来源:NextAndPreviousLinks.php
示例2: link_rel_prev_next
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());
}
}
开发者ID:josephholsten,项目名称:Link-rel-prev-next,代码行数:30,代码来源:link_rel_prev_next.php
示例3: load_settings
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'];
}
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:28,代码来源:wp-post-navigation.php
示例4: prev_next_post_link
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
}
开发者ID:kenyakodaira,项目名称:kenyanke,代码行数:31,代码来源:template-prev-next-link.php
示例5: beans_child_previous_text_post_navigation
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;
}
开发者ID:ThemeButler,项目名称:tm-site,代码行数:7,代码来源:single.php
示例6: zp_get_portfolio_sidebar
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');
}
开发者ID:sello-rex,项目名称:ased,代码行数:59,代码来源:single-portfolio.php
示例7: getSinglePost
/**
* Возвращает массив данных о записи
* @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;
}
开发者ID:Valeriya-Alekseeva,项目名称:ShowplaceUdmurtia,代码行数:62,代码来源:ContentHelper.php
示例8: filter_previous_post_link
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;
}
开发者ID:kamleshcropin,项目名称:Agency-Theme,代码行数:9,代码来源:utility-functions.php
示例9: singular_content_footer
/**
* 個別ページ用のコンテンツフッターを表示
*/
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;
}
}
开发者ID:Aquei,项目名称:purely,代码行数:59,代码来源:singular_content_footer.php
示例10: wptouch_theme_get_previous_post_link
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>';
}
}
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:10,代码来源:functions.php
示例11: eryn_post_nav
/**
* 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
}
开发者ID:COfrost,项目名称:www.example.dev,代码行数:58,代码来源:template-tags.php
示例12: tls_latest_edition_page_json_api_encode
/**
* 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;
}
开发者ID:dannyoz,项目名称:tls,代码行数:61,代码来源:tls_latest_edition_page_json_api_encode.php
示例13: previousPortfolioLink
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();
}
}
开发者ID:steveMQ,项目名称:Hairpin,代码行数:12,代码来源:portfolio-navigation.php
示例14: add_title_to_previous_post_link
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;
}
开发者ID:gigikir,项目名称:adebe,代码行数:13,代码来源:_social_ktz.php
示例15: render
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;
}
开发者ID:e-picas,项目名称:wp-basic-bootstrap,代码行数:13,代码来源:WP_Basic_Bootstrap_Pagination.php
示例16: previous_post_link_short
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;
}
开发者ID:komagata,项目名称:short_title_link,代码行数:18,代码来源:short_title_link.php
示例17: get_next_previous_port_id
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;
}
开发者ID:djs11491,项目名称:gallant,代码行数:18,代码来源:template.php
示例18: previous_post
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;
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:19,代码来源:deprecated.php
示例19: micronav
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
}
开发者ID:TwoBeers,项目名称:wallow,代码行数:43,代码来源:quickbar.php
示例20: tarski_next_prev_posts
/**
* 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";
}
}
}
开发者ID:aleksking,项目名称:sherrill,代码行数:37,代码来源:content_helper.php
注:本文中的get_previous_post函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论