Tagged: x
-
AuthorPosts
-
August 15, 2016 at 4:49 am #1131635
Malte KParticipantHello I would like to add an extra Button to the native Page Navigation [all posts (just a link to a page) / next post / prev post]. Is there a simple function, which i can add in the function.php, which can do this?
Best,
Malte
August 15, 2016 at 5:06 am #1131655
ChristopherModeratorHi there,
Please add following code in child theme’s functions.php file :
// Entry Navigation // ============================================================================= if ( ! function_exists( 'x_entry_navigation' ) ) : function x_entry_navigation() { $stack = x_get_stack(); if ( $stack == 'ethos' ) { $left_icon = '<i class="x-icon-chevron-left" data-x-icon=""></i>'; $right_icon = '<i class="x-icon-chevron-right" data-x-icon=""></i>'; } else { $left_icon = '<i class="x-icon-arrow-left" data-x-icon=""></i>'; $right_icon = '<i class="x-icon-arrow-right" data-x-icon=""></i>'; } $is_ltr = ! is_rtl(); $prev_post = get_adjacent_post( false, '', false ); $next_post = get_adjacent_post( false, '', true ); $prev_icon = ( $is_ltr ) ? $left_icon : $right_icon; $next_icon = ( $is_ltr ) ? $right_icon : $left_icon; ?> <div class="custom-btn"> <?php echo do_shortcode('[x_button type="real" shape="square" size="mini" href="#example" title="Example"]Square Button[/x_button]'); ?> </div> <div class="x-nav-articles"> <?php if ( $prev_post ) : ?> <a href="<?php echo get_permalink( $prev_post ); ?>" title="<?php __( 'Previous Post', '__x__' ); ?>" class="prev"> <?php echo $prev_icon; ?> </a> <?php endif; ?> <?php if ( $next_post ) : ?> <a href="<?php echo get_permalink( $next_post ); ?>" title="<?php __( 'Next Post', '__x__' ); ?>" class="next"> <?php echo $next_icon; ?> </a> <?php endif; ?> </div> <?php } endif;Hope it helps.
August 15, 2016 at 5:37 am #1131684
Malte KParticipantI changed the Code to this, now it is working perfectly. For different costum post types different URLS and a thumbnail button. THX!
// Entry Navigation // ============================================================================= if ( ! function_exists( 'x_entry_navigation' ) ) : function x_entry_navigation() { $stack = x_get_stack(); if ( $stack == 'ethos' ) { $left_icon = '<i class="x-icon-chevron-left" data-x-icon=""></i>'; $right_icon = '<i class="x-icon-chevron-right" data-x-icon=""></i>'; } else { $left_icon = '<i class="x-icon-arrow-left" data-x-icon=""></i>'; $right_icon = '<i class="x-icon-arrow-right" data-x-icon=""></i>'; } $is_ltr = ! is_rtl(); $prev_post = get_adjacent_post( false, '', false ); $next_post = get_adjacent_post( false, '', true ); $prev_icon = ( $is_ltr ) ? $left_icon : $right_icon; $next_icon = ( $is_ltr ) ? $right_icon : $left_icon; // Costum URL for Costum Post Type - Archive if ( is_singular( 'ausstellung' ) ) { $url = 'http://maltekebbel.de/ausstellungen'; } if ( is_singular( 'arbeit' ) ) { $url = 'http://maltekebbel.de/arbeiten'; } if ( is_singular( 'post' ) ) { $url = 'http://maltekebbel.de/blog'; } ?> <div class="x-nav-articles" style="width: 123px !important;"> <?php /* Extra Button */ echo do_shortcode('<a href="'.$url.'" style="float:left; margin-right:6px !important;">[x_icon type="th"]</a>'); ?> <?php if ( $prev_post ) : ?> <a href="<?php echo get_permalink( $prev_post ); ?>" title="<?php __( 'Previous Post', '__x__' ); ?>" class="prev"> <?php echo $prev_icon; ?> </a> <?php endif; ?> <?php if ( $next_post ) : ?> <a href="<?php echo get_permalink( $next_post ); ?>" title="<?php __( 'Next Post', '__x__' ); ?>" class="next"> <?php echo $next_icon; ?> </a> <?php endif; ?> </div> <?php } endif;August 15, 2016 at 6:08 am #1131715
ThaiModeratorIf you need anything else please let us know.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1131635 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
