Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //* Make Font Awesome available
- add_action( 'wp_enqueue_scripts', 'enqueue_font_awesome' );
- function enqueue_font_awesome() {
- wp_enqueue_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css' );
- }
- add_action( 'wp_enqueue_scripts', 'sk_sitewide_non_handhelds_scripts' );
- /**
- * Load js file having the code for pushing the prev/next links off screen and animating on hover.
- *
- * Context: Single Posts and 'movies' CPT's single entries, on desktops only.
- *
- * @author Sridhar Katakam
- * @link http://sridharkatakam.com/
- */
- function sk_sitewide_non_handhelds_scripts() {
- if ( is_singular( array( 'post', 'movies' ) ) && ! wp_is_mobile() ) {
- wp_enqueue_script( 'sitewide-non-handhelds', get_stylesheet_directory_uri() . '/js/sitewide-non-handhelds.js', array( 'jquery' ), '1.0.0', true );
- }
- }
- add_action( 'genesis_loop', 'sk_fixed_cpt_nav' );
- /**
- * Display links to previous and next entries.
- *
- * Context: Single Posts and 'movies' CPT's single entries, on desktops only.
- *
- */
- function sk_fixed_cpt_nav() {
- if ( is_singular( array( 'post', 'movies' ) ) && ! wp_is_mobile() ) {
- // http://codex.wordpress.org/Function_Reference/get_adjacent_post
- // get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy )
- $prev_post = get_adjacent_post( false, '', true );
- $next_post = get_adjacent_post( false, '', false );
- if ( empty( $prev_post ) && empty( $next_post ) ) {
- return;
- } ?>
- <div class="btn-wrap">
- <?php if ( !empty( $prev_post ) ) { ?>
- <a class="prevBtn" href="<?php echo $prev_post->guid; ?>"><?php echo $prev_post->post_title; ?><i class="fa fa-chevron-left"></i></a>
- <?php } ?>
- <?php if ( !empty( $next_post ) ) { ?>
- <a class="nextBtn" href="<?php echo $next_post->guid; ?>"><i class="fa fa-chevron-right"></i><?php echo $next_post->post_title; ?></a>
- <?php } ?>
- </div>
- <?php
- }
- }
- add_action( 'genesis_after_entry', 'sk_custom_post_nav' );
- /**
- * Display links to previous and next entries.
- *
- * Context: Single Posts and 'movies' CPT's single entries, on handhelds only.
- *
- */
- function sk_custom_post_nav() {
- if ( wp_is_mobile() && is_singular( array( 'post', 'movies' ) ) ) {
- echo '<div class="prev-next-post-links">';
- previous_post_link('<div class="previous-post-link">« %link</div>', '<strong>%title</strong>' );
- next_post_link('<div class="next-post-link">%link »</div>', '<strong>%title</strong>' );
- echo '</div>';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement