コード例 #1
1
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 
    }
}
コード例 #2
0
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());
    }
}
コード例 #3
0
function next_post_link_product()
{
    global $post;
    $next_post = get_next_post(true, '', 'product_cat');
    if (is_a($next_post, 'WP_Post')) {
        ?>
       <div class="prod-dropdown">
                <a href="<?php 
        echo get_the_permalink($next_post->ID);
        ?>
" rel="next" class="icon-angle-left next"></a>
                <div class="nav-dropdown" style="display: none;">
                  <a title="<?php 
        echo get_the_title($next_post->ID);
        ?>
" href="<?php 
        echo get_the_permalink($next_post->ID);
        ?>
">
                  <?php 
        echo get_the_post_thumbnail($next_post->ID, apply_filters('single_product_small_thumbnail_size', 'shop_thumbnail'));
        ?>
</a>

                </div>
            </div>
    <?php 
    }
}
コード例 #4
0
 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'];
 }
コード例 #5
0
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', '&#8656;%title', false);
        ?>
      </div>
    <?php 
    }
    ?>
    <?php 
    if ($next_post) {
        ?>
      <div id="next_post">
        <?php 
        next_post_link('%link', '%title&#8658;', false);
        ?>
      </div>
    <?php 
    }
    ?>
  </div>
<?php 
}
コード例 #6
0
ファイル: single-portfolio.php プロジェクト: sello-rex/ased
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');
}
コード例 #7
0
ファイル: functions.php プロジェクト: nukulb/bugsbounty-blog
}
add_custom_image_header('header_style', 'admin_header_style');
register_sidebar(array('before_widget' => '<li id="%1$s" class="widget-container %2$s">', 'after_widget' => '</li>', 'before_title' => '<span class="widget-title">', 'after_title' => '</span>'));
/** -----------------------------------------------
		 * Theme uses wp_nav_menu() in one location. Chack if function exist
	*/
if (function_exists('register_nav_menus')) {
    register_nav_menus(array('primary' => __('Primary Navigation', 'Summ')));
}
コード例 #8
0
function filter_next_post_link($link)
{
    global $post;
    $post = get_post($post_id);
    $next_post = get_next_post();
    $title = $next_post->post_title;
    $link = str_replace("rel=", 'class="next" rel=', $link);
    return $link;
}
コード例 #9
0
/**
 * 個別ページ用のコンテンツフッターを表示
 */
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 : "&nbsp;";
    $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;
    }
}
コード例 #10
0
function wptouch_theme_get_next_post_link()
{
    $next_post = get_next_post();
    if ($next_post) {
        $next_post = get_next_post(false);
        $next_url = get_permalink($next_post->ID);
        //		echo '<a href="#" rel="' . $next_url . '" class="nav-fwd ajax-link">'. __( "Next", "wptouch-pro" ) . '</a>'; <- playing with ajax
        echo '<a href="' . $next_url . '" class="nav-fwd ajax-link">' . __("Next", "wptouch-pro") . '</a>';
    }
}
コード例 #11
0
    /**
     * 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">&larr;</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">&rarr;</span>
                    </a>
                </div>
			<?php 
        }
        ?>
		</div><!-- .nav-links -->
	</nav><!-- .navigation -->
	<?php 
    }
コード例 #12
0
/**
 * 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;
}
コード例 #13
0
function nextPortfolioLink()
{
    if (get_next_post()) {
        next_post_link('%link', getPostLinkIcon('right'));
    } else {
        $args = array('post_type' => 'portfolio', 'posts_per_page' => 1, 'order' => 'ASC');
        $last = new WP_Query($args);
        $last->the_post();
        echo '<a rel="next" href="' . get_permalink() . '">' . getPostLinkIcon('right') . '</a>';
        wp_reset_query();
    }
}
コード例 #14
0
 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;
 }
コード例 #15
0
ファイル: _social_ktz.php プロジェクト: gigikir/adebe
function add_title_to_next_post_link($link)
{
    global $post;
    $post = get_post($post->ID);
    $next_post = get_next_post();
    if ($next_post) {
        $title = $next_post->post_title;
    } else {
        $title = '';
    }
    $link = str_replace("rel=", " title='" . $title . "' rel=", $link);
    return $link;
}
コード例 #16
0
function next_post_link_short($format = '%link &raquo;', $link = '%title', $in_same_cat = false, $excluded_categories = '', $length = 32)
{
    $post = get_next_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 = $string . $link . '</a>';
    $format = str_replace('%link', $link, $format);
    echo $format;
}
コード例 #17
0
function inf_next_post($content)
{
    if (!is_single()) {
        return $content;
    }
    $next_post = get_next_post();
    if (!$next_post) {
        $next_ID = $next_URL = '';
    } else {
        $next_ID = $next_post->ID;
        $next_URL = get_permalink($next_post->ID);
    }
    $inf_content = "<input type='hidden' class='inf-next-post' data-id='" . $next_ID . "' data-url='" . $next_URL . "'/>";
    $inf_content .= $content;
    return $inf_content;
}
コード例 #18
0
ファイル: template.php プロジェクト: djs11491/gallant
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;
}
コード例 #19
0
ファイル: quickbar.php プロジェクト: TwoBeers/wallow
    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())) . '">&nbsp;</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())) . '">&nbsp;</a>' : '';
        } elseif ($is_archive) {
            $prev = get_next_posts_link() ? get_next_posts_link('&nbsp;') : '';
            $next = get_previous_posts_link() ? get_previous_posts_link('&nbsp;') : '';
        } 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());
        ?>
">&nbsp;</a></div>
		<div class="up"><a title="<?php 
        esc_attr_e('Top', 'wallow');
        ?>
" href="#">&nbsp;</a></div>
		<div class="down"><a title="<?php 
        esc_attr_e('Bottom', 'wallow');
        ?>
" href="#credits">&nbsp;</a></div>
	</div>
<?php 
    }
コード例 #20
0
function next_post($format = '%', $next = 'next post: ', $title = 'yes', $in_same_cat = 'no', $limitnext = 1, $excluded_categories = '')
{
    if (empty($in_same_cat) || 'no' == $in_same_cat) {
        $in_same_cat = false;
    } else {
        $in_same_cat = true;
    }
    $post = get_next_post($in_same_cat, $excluded_categories);
    if (!$post) {
        return;
    }
    $string = '<a href="' . get_permalink($post->ID) . '">' . $next;
    if ('yes' == $title) {
        $string .= apply_filters('the_title', $post->post_title, $nextpost);
    }
    $string .= '</a>';
    $format = str_replace('%', $string, $format);
    echo $format;
}
コード例 #21
0
ファイル: template-tags.php プロジェクト: abhiShandy/t5e
    /**
     * Display navigation to next/previous set of posts when applicable.
     */
    function boardwalk_paging_nav()
    {
        // Don't print empty markup if there's only one page.
        if ($GLOBALS['wp_query']->max_num_pages < 2) {
            return;
        }
        ?>
	<nav class="navigation paging-navigation" role="navigation">
		<h1 class="screen-reader-text"><?php 
        _e('Posts navigation', 'boardwalk');
        ?>
</h1>
		<div class="nav-links">

			<?php 
        if (get_next_posts_link()) {
            ?>
			<div class="nav-previous"><?php 
            next_posts_link('<span class="screen-reader-text">' . __('<span class="meta-nav">&larr;</span> Older posts', 'boardwalk') . '</span>');
            ?>
				<?php 
            echo get_next_post();
            ?>
			</div>
			<?php 
        }
        ?>

			<?php 
        if (get_previous_posts_link()) {
            ?>
			<div class="nav-next"><?php 
            previous_posts_link('<span class="screen-reader-text">' . __('Newer posts <span class="meta-nav">&rarr;</span>', 'boardwalk') . '</span>');
            ?>
</div>
			<?php 
        }
        ?>

		</div><!-- .nav-links -->
	</nav><!-- .navigation -->
	<?php 
    }
コード例 #22
0
    function swell_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', 'swell');
        ?>
</h1>
			<div class="nav-links">				
				<?php 
        next_post_link('<div class="nav-next">%link</div>', _x('<span class="meta-nav">&larr;</span> %title', 'Next post link', 'swell'));
        $portfolio_page_id = swell_get_portfolio_id();
        if ($portfolio_page_id) {
            ?>
 
					<div class="nav-portfolio <?php 
            if (!get_next_post()) {
                echo 'inactive';
            }
            ?>
">
						<a href="<?php 
            echo esc_url(get_permalink($portfolio_page_id));
            ?>
"></a>
					</div>
					<?php 
        }
        previous_post_link('<div class="nav-previous">%link</div>', _x('%title <span class="meta-nav">&rarr;</span>', 'Previous post link', 'swell'));
        ?>
			</div><!-- .nav-links -->
		</nav><!-- .navigation -->
		<?php 
    }
コード例 #23
0
ファイル: content_helper.php プロジェクト: aleksking/sherrill
/**
 * 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', '&lsaquo; %title');
                echo '</span>';
                if ($next_post) {
                    echo ' <span class="separator">&nbsp;&bull;&nbsp;</span> ';
                }
            }
            if ($next_post) {
                echo '<span class="next-entry">';
                next_post_link('%link', '%title &rsaquo;');
                echo '</span>';
            }
            echo "</p>\n";
        }
    }
}
コード例 #24
0
ファイル: single.php プロジェクト: jun200/wordpress
        }
        ?>

      <!-- 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>
        <?php 
        }
        ?>
      </div>
      <!-- /post navigation -->

      <?php 
        comments_template();
        // コメント欄の表示
コード例 #25
0
if (have_posts()) {
    ?>
	<?php 
    while (have_posts()) {
        the_post();
        ?>
<div class="mainPageTitle singlePortfolioTitle">
	<div class="colorContainer">
		<div class="container">
			<h1><?php 
        esc_html_e('Portfolio', 'circleflip');
        ?>
</h1>
			<div class="links right clearfix">
				<?php 
        if (get_next_post()) {
            ?>
					<div class="nextPost right"><?php 
            next_post_link('%link', __('Next', 'circleflip'));
            ?>
</div>
				<?php 
        } else {
            ?>
					<div class="nextPost right disabled"><a><?php 
            esc_html_e('Next', 'circleflip');
            ?>
</a></div>
				<?php 
        }
        ?>
コード例 #26
0
ファイル: single.php プロジェクト: shopline/doxytheme
                  <li class="previous">
                    <?php 
                previous_post_link('<span class="previous-page">%link</span>', __('<i class="fa fa-caret-left"></i>', 'bones') . '&nbsp;' . 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>', '&nbsp;' . brew_truncate_text(get_next_post()->post_title, $trunc_limit) . '&nbsp;' . __('<i class="fa fa-caret-right"></i>', 'bones'));
                ?>
                  </li>
                <?php 
            }
            // end if
            ?>

              </ul>
            </div><!-- /#single-post-nav -->
          <?php 
        }
        ?>

          <?php 
        comments_template();
コード例 #27
0
 function zm_next_post()
 {
     global $post;
     // Retrieve next post link that is adjacent to current post.
     $nextPost = get_next_post(false);
     // Check to make sure we have a previous post
     if (!empty($nextPost)) {
         if (function_exists('get_the_post_thumbnail')) {
             $nextThumbnail = get_the_post_thumbnail($nextPost->ID, 'thumbnail');
         }
         /** @todo markup should be 'cleaner' */
         echo '<div class="image">';
         if (isset($nextThumbnail) && !empty($nextThumbnail)) {
             next_post_link('%link', "{$nextThumbnail}", false);
         }
         echo '</div>';
         print '<div class="content">';
         print '<span class="title">';
         next_post_link('%link', '%title');
         print '</span>';
         // Get our list of catgeories
         if (get_the_category($nextPost->ID)) {
             // Returns an array of objects
             $categories = get_the_category($nextPost->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>';
     }
 }
コード例 #28
0
ファイル: single.php プロジェクト: alx/Tetalab
        ?>
" onclick="return confirm('<?php 
        _e("Mail a link to this post?", "wptouch");
        ?>
');" id="omail"></a></li>
		<?php 
        wptouch_twitter_link();
        // This detects if it's an Apple mobile device or not and serves up the right Twitter link
        ?>
		<li><a href="javascript:return false;" onclick="wptouch_toggle_bookmarks();" id="obook"></a></li>
		<?php 
        $nextPost = get_next_post();
        if ($nextPost) {
            ?>
			<li><a href="<?php 
            $nextPost = get_next_post(false);
            $nextURL = get_permalink($nextPost->ID);
            echo $nextURL;
            ?>
" id="onext"></a></li>
		<?php 
        }
        ?>
		</ul>
    </div>

  	<div id="twitter-box" style="display:none">
		<ul>
			<li><a href="javascript:return false;" onclick="window.location='tweetie:'+window.location"><img src="<?php 
        echo compat_get_plugin_url('wptouch');
        ?>
コード例 #29
0
ファイル: misc.php プロジェクト: SayenkoDesign/ividf
function om_get_next_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_next_post($in_same_cat, $excluded_categories);
    } else {
        return om_get_adjacent_post($in_same_cat, $excluded_categories, false, $taxonomy, $orderby);
    }
}
コード例 #30
0
    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 
        }
    }