Digital experiences for all disciplines
New Landing › How can we help? › Cardinal › Next/Prev article thumbnail
New Landing › How can we help? › Cardinal › Next/Prev article thumbnail
- This topic has 8 replies, 3 voices, and was last updated 9 years by Kyle – SUPPORT.
-
Posted in: Cardinal
-
May 5, 2015 at 4:06 pm #172037
Hi,
Actually, in the pagination section of a post page, I’ve the title, the author and the categories of the next and the prev post.
How can I display the thumbnail too ?
Thank you in advance for your response.
May 5, 2015 at 5:29 pm #172077Hi,
Can you provide a screenshot and the url to an example page?
Thanks-Rui
May 5, 2015 at 5:34 pm #172079Here is a screenshot.
The page is password restricted, if you want see the page, I can send you the credentials. But with the screenshot I think it’s not necessary.
Attachments:
You must be logged in to view attached files.May 5, 2015 at 5:43 pm #172084Hi
I’m afraid that customisation is beyond our scope of support as it requires quite a bit of work, editing theme files, adjust layout, restyling etc
– Kyle
May 5, 2015 at 5:46 pm #172090It’s not a problem for me, I’m developer.
Can you indicate me the appropriate files to modify please ?
I think it’s only get the thumbnail in php, at the same time to getting the title, etc.
May 5, 2015 at 5:52 pm #172092Add this to your child theme functions.php file, and add your code:
/* POST PAGINATION ================================================== */ if ( ! function_exists( 'sf_post_pagination' ) ) { function sf_post_pagination() { global $sf_options, $sf_sidebar_config; $single_author = $sf_options['single_author']; $remove_dates = $sf_options['remove_dates']; $pagination_style = "standard"; if ( isset( $sf_options['pagination_style'] ) ) { $pagination_style = $sf_options['pagination_style']; } $prev_post = get_next_post(); $next_post = get_previous_post(); $has_both = false; if ( sf_theme_opts_name() == "sf_joyn_options" && $pagination_style == "fs-arrow" ) { return; } if ( ! empty( $next_post ) && ! empty( $prev_post ) ) { $has_both = true; } ?> <?php if ( ! empty( $next_post ) || ! empty( $prev_post )) { ?> <?php if ($has_both) { ?> <div class="post-pagination-wrap prev-next"> <?php } else { ?> <div class="post-pagination-wrap"> <?php } ?> <div class="container"> <?php if ( ! empty( $next_post ) ) { $author_id = $next_post->post_author; $author_name = get_the_author_meta( 'display_name', $author_id ); $author_url = get_author_posts_url( $author_id ); $post_date = get_the_date(); $post_date_str = get_the_date('Y-m-d'); $post_categories = get_the_category_list( ', ', '', $next_post->ID ); ?> <div class="next-article"> <h6><?php _e( "Next Article", 'swiftframework' ); ?></h6> <h2> <a href="<?php echo get_permalink( $next_post->ID ); ?>"><?php echo $next_post->post_title; ?></a> </h2> <?php if ( $single_author && ! $remove_dates ) { ?> <div class="blog-item-details"><?php echo sprintf( __( 'In %1$s on <time datetime="%2$s">%3$s</time>', 'swiftframework' ), $post_categories, $post_date_str, $post_date ); ?></div> <?php } else if ( ! $remove_dates ) { ?> <div class="blog-item-details"><?php echo sprintf( __( '<span class="author">By <a href="%2$s" rel="author" itemprop="author">%1$s</a></span> in %3$s on <time datetime="%4$s">%5$s</time>', 'swiftframework' ), $author_name, $author_url, $post_categories, $post_date_str, $post_date ); ?></div> <?php } else if ( ! $single_author ) { ?> <div class="blog-item-details"><?php echo sprintf( __( '<span class="author">By <a href="%2$s" rel="author" itemprop="author">%1$s</a></span> in %3$s', 'swiftframework' ), $author_name, $author_url, $post_categories ); ?></div> <?php } ?> </div> <?php } ?> <?php if ( ! empty( $prev_post ) ) { $author_id = $prev_post->post_author; $author_name = get_the_author_meta( 'display_name', $author_id ); $author_url = get_author_posts_url( $author_id ); $post_date = get_the_date(); $post_date_str = get_the_date('Y-m-d'); $post_categories = get_the_category_list( ', ', '', $prev_post->ID ); ?> <div class="prev-article"> <h6><?php _e( "Previous Article", 'swiftframework' ); ?></h6> <h2> <a href="<?php echo get_permalink( $prev_post->ID ); ?>"><?php echo $prev_post->post_title; ?></a> </h2> <?php if ( $single_author && ! $remove_dates ) { ?> <div class="blog-item-details"><?php echo sprintf( __( 'In %1$s on <time datetime="%2$s">%3$s</time>', 'swiftframework' ), $post_categories, $post_date_str, $post_date ); ?></div> <?php } else if ( ! $remove_dates ) { ?> <div class="blog-item-details"><?php echo sprintf( __( '<span class="author">By <a href="%2$s" rel="author" itemprop="author">%1$s</a></span> in %3$s on <time datetime="%4$s">%5$s</time>', 'swiftframework' ), $author_name, $author_url, $post_categories, $post_date_str, $post_date ); ?></div> <?php } else if ( ! $single_author ) { ?> <div class="blog-item-details"><?php echo sprintf( __( '<span class="author">By <a href="%2$s" rel="author" itemprop="author">%1$s</a></span> in %3$s', 'swiftframework' ), $author_name, $author_url, $post_categories ); ?></div> <?php } ?> </div> <?php } ?> </div> </div> <?php } ?> <?php } add_action( 'sf_post_after_article', 'sf_post_pagination', 5 ); }
– Kyle
May 5, 2015 at 5:55 pm #172094Use $prev_post->ID and $next_post->ID has an Id to get the thumbnails.
-Rui
May 6, 2015 at 10:35 am #172308Thank you, it works perfectly 🙂
May 6, 2015 at 10:38 am #172311Thanks Rui
-
Posted in: Cardinal
You must be logged in and have valid license to reply to this topic.