- This topic has 5 replies, 2 voices, and was last updated 10 years ago by Sakin.
-
AuthorPosts
-
April 22, 2014 at 2:58 pm #26878LE DAMember
Hi,
I’d like to display post titles rather than “previous and next post” in single post.
How can I do ?
Thanks,
Muriel
April 22, 2014 at 10:20 pm #26931SakinKeymaster@LE DA: For this you need to build child theme and create functions.php file in your child then and then copy catchbox_content_nav() function and edit it in your child theme.
April 22, 2014 at 11:04 pm #26949LE DAMemberOk Sakin for copy catchbox content nav in child theme but after ?
I suppose I must change some lines, no ?
Can you tell me, please, what to do after ?
This is “content nav function” I’ve had copy :
if ( ! function_exists( ‘catchbox_content_nav’ ) ) :
/**
* Display navigation to next/previous pages when applicable
*/
function catchbox_content_nav( $nav_id ) {
global $wp_query;/**
* Check Jetpack Infinite Scroll
* if it’s active then disable pagination
*/
if ( class_exists( ‘Jetpack’, false ) ) {
$jetpack_active_modules = get_option(‘jetpack_active_modules’);
if ( $jetpack_active_modules && in_array( ‘infinite-scroll’, $jetpack_active_modules ) ) {
return false;
}
}if ( $wp_query->max_num_pages > 1 ) { ?>
<nav id=”<?php echo $nav_id; ?>”>
<h3 class=”assistive-text”><?php _e( ‘Post navigation’, ‘catchbox’ ); ?></h3>
<?php if ( function_exists(‘wp_pagenavi’ ) ) {
wp_pagenavi();
}
elseif ( function_exists(‘wp_page_numbers’ ) ) {
wp_page_numbers();
}
else { ?>
<div class=”nav-previous”><?php next_posts_link( __( ‘<span class=”meta-nav”>←</span> Older posts’, ‘catchbox’ ) ); ?></div>
<div class=”nav-next”><?php previous_posts_link( __( ‘Newer posts <span class=”meta-nav”>→</span>’, ‘catchbox’ ) ); ?></div>
<?php
} ?>
</nav><!– #nav –>
<?php
}}
endif; // catchbox_content_navif ( ! function_exists( ‘catchbox_content_query_nav’ ) ) :
/**
* Display navigation to next/previous pages when applicable
*/
function catchbox_content_query_nav( $nav_id ) {
global $wp_query;if ( $wp_query->max_num_pages > 1 ) { ?>
<nav id=”<?php echo $nav_id; ?>”>
<h3 class=”assistive-text”><?php _e( ‘Post navigation’, ‘catchbox’ ); ?></h3>
<?php if ( function_exists(‘wp_pagenavi’ ) ) {
wp_pagenavi();
}
elseif ( function_exists(‘wp_page_numbers’ ) ) {
wp_page_numbers();
}
else { ?>
<div class=”nav-previous”><?php next_posts_link( __( ‘<span class=”meta-nav”>←</span> Older posts’, ‘catchbox’ ) ); ?></div>
<div class=”nav-next”><?php previous_posts_link( __( ‘Newer posts <span class=”meta-nav”>→</span>’, ‘catchbox’ ) ); ?></div>
<?php
} ?>
</nav><!– #nav –>
<?php
}
}
endif; // catchbox_content_navApril 22, 2014 at 11:33 pm #26953SakinKeymaster@LE DA: Oh sorry! you are trying to change it in single post right? Then ignore y previous comment. You need to build child theme and then copy single.php file and replace the following code.
<nav id="nav-single"> <h3 class="assistive-text"><?php _e( 'Post navigation', 'catchbox' ); ?></h3> <span class="nav-previous"><?php previous_post_link( '%link', __( '<span class="meta-nav">←</span> Previous', 'catchbox' ) ); ?></span> <span class="nav-next"><?php next_post_link( '%link', __( 'Next <span class="meta-nav">→</span>', 'catchbox' ) ); ?></span> </nav><!-- #nav-single -->
With
<nav id="nav-single"> <h3 class="assistive-text"><?php _e( 'Post navigation', 'catchbox' ); ?></h3> <span class="nav-previous"><?php previous_post_link(); ?></span> <span class="nav-next"><?php next_post_link(); ?></span> </nav><!-- #nav-single -->
April 23, 2014 at 12:17 am #26962LE DAMemberThanks Sakin, it’s OK!
I have one final question :
“Nav post” is at the beginning of post (Before the title) and I’d like to put it at the end of post, just before “Leave a comment” (sorry for my english).
How can I do ?
Thanks a lot
April 23, 2014 at 12:47 am #26969SakinKeymaster@LE DA: Then you can move that code to just above the code
<?php comments_template( '', true ); ?>
-
AuthorPosts
- The topic ‘Single post : display post titles’ is closed to new replies.