-
AuthorPosts
-
November 10, 2016 at 7:38 pm #1252581
Name: JFantasyBooks
Site: Fantasy-Books
Site Url: https://fantasy-books.live
WordPress Version: 4.6.1
X Version: 4.6.4
Cornerstone Plugin Version: 1.3.3Problem:
I’m trying to add these buttons to the bottom of my posts, but they are not appearing. Any ideas why? It has to be by php.
// Additional Navigational Functions // ============================================================================= function x_navigation_postsx() { if ( is_singular('post') ) { $stack = x_get_stack(); $is_ltr = ! is_rtl(); $prev_post = get_adjacent_post( true, '', true ); $next_post = get_adjacent_post( true, '', false ); ?> <div class="x-nav-articles"> <?php if ( $prev_post ) : ?> <?php echo do_shortcode('[button type="flat" shape="square" size="large" block="true" href="<?php echo get_permalink( $prev_post ); ?>" class="prev"][icon type="angle-double-right"]Next Chapter[/button]');?> <?php endif; ?> <?php if ( $next_post ) : ?> <?php echo do_shortcode('[button type="flat" shape="square" size="large" block="true" href="<?php echo get_permalink( $next_post ); ?>" class="next"][icon type="angle-double-right"]Next Chapter[/button]');?> <?php endif; ?> </div> <?php } }
November 11, 2016 at 12:18 am #1252864Hi there,
Thanks for writing in! Unfortunately we can’t assist on such custom code. You can check similar function from /framework/functions/global/content.php
cheers!
November 11, 2016 at 12:39 am #1252880Can you at least tell me a few things?
Like,
1. can I indeed put this in the functions.php when I get it right, and it would work? And if not, what .php file am I going for?
2. Whether that div class for those buttons are correct?
November 11, 2016 at 2:54 am #1253004Hello There,
Thank you for the clarifications! You do have the custom function but you did not hook it to the single post and that is why it is not showing up. Please have your code updated and use this instead:
// Add a next/previous links at the bottom of the single blog post // ============================================================================= function x_navigation_postsx() { if ( is_singular('post') ) { $stack = x_get_stack(); $is_ltr = ! is_rtl(); $prev_post = get_adjacent_post( true, '', true ); $next_post = get_adjacent_post( true, '', false ); ?> <div class="x-nav-articles"> <?php if ( $prev_post ) : ?> <?php echo do_shortcode('[button type="flat" shape="square" size="large" block="true" href="<?php echo get_permalink( $prev_post ); ?>" class="prev"][icon type="angle-double-right"]Next Chapter[/button]');?> <?php endif; ?> <?php if ( $next_post ) : ?> <?php echo do_shortcode('[button type="flat" shape="square" size="large" block="true" href="<?php echo get_permalink( $next_post ); ?>" class="next"][icon type="angle-double-right"]Next Chapter[/button]');?> <?php endif; ?> </div> <?php } } add_action('x_before_the_content_end', 'x_navigation_postsx'); // =============================================================================
Hope this helps. Kindly let us know.
November 11, 2016 at 3:35 am #1253049Thank you!
November 11, 2016 at 5:29 am #1253187You’re welcome! 🙂
-
AuthorPosts