Navigation Links on Posts
-
Basically, instead of having the Previous/Next links be above my post’s content, I want them at the footer of the content. Also, I’d like to change it to “Previous Post” and “Next Post” instead of the post titles. I was able to change this in a previous version of the theme, but don’t know how to do it in the current version.
Here’s really all I want:
Refer to this thread… and if you have trouble, lemme know.
https://forum.graphene-theme.com/graphene-support/post-links-at-both-top-and-bottom-of-category-page
After you get it appearing at the bottom where you want… we can then use CSS to go back and hide the top ones.
Thanks, Josh! I was able to create the action hook widget and copied/pasted the code into the text widget, but nothing appears at the end of my post. I can see a new, empty space where the widget occupies, but no links.
You can see that space under the social buttons at the bottom here:
http://alphacounter.com/2012/12/06/alpha-counter-podcast-43-intorducing-alpha-counter-live/
I also haven’t been able to find where in the CSS I can remove the links at the top. (I’m very much a novice.)
1. You can’t put php code in text widget. Install some php widgets plugin and follow that advice.
2. Or do like this:
open loop-single.php file from Graphene Theme and copy all content in new file with same name.
save file and upload it to child-theme folder
open file in editor (the one in child-theme folder) and find this:
<?php graphene_post_nav(); ?>
select and cut (ctrl+x), find this part of code in same file:
<?php /*** Display the post author's bio in single-post page if enabled*/
if ( $graphene_settings['show_post_author'] ) :?>
<h4 class="author_h4 vcard"><?php _e( 'About the author', 'graphene' ); ?></h4>...and paste it before opening php tag to look like this:
<?php graphene_post_nav(); ?>
<?php/** * Display the post author's bio in single-post page if enabled*/
if ( $graphene_settings['show_post_author'] ) :?>
<h4 class="author_h4 vcard"><?php _e( 'About the author', 'graphene' ); ?></h4>...It’s not neat and fancy but will work ๐
First add this to custom CSS
post-nav {
display: none;
}Then this to child-theme’s functions.php anywhere between
<?php
and?>
function graphene_custom_post_nav(){
if ( is_singular() ) :
global $graphene_settings;
$args = array(
'format_prev' => 'รยซ %link',
'format_next' => '%link รยป',
'link' => '%title',
'in_same_cat' => false,
'excluded_cats' => '',
);
if ( $graphene_settings['slider_type'] == 'categories' )
if ( $graphene_settings['slider_exclude_categories'] == 'everywhere' )
$args['excluded_cats'] = $graphene_settings['slider_specific_categories'];
$args = apply_filters( 'graphene_post_nav_args', $args );
?>
<div class="custom-post-nav clearfix">
<p class="previous"><?php previous_post_link( $args['format_prev'], $args['link'], $args['in_same_cat'], $args['excluded_cats'] ); ?></p>
<p class="next-post"><?php next_post_link( $args['format_next'], $args['link'], $args['in_same_cat'], $args['excluded_cats'] ); ?></p>
</div>
<?php
endif;
}
add_action('graphene_post_footer','graphene_custom_post_nav');And unlike mine, Prasanna’s solution is neat and fancy ๐ .
Viewing 6 posts - 1 through 6 (of 6 total)
- You must be logged in to reply to this topic.