Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Uplift › How to Change 'Related Articles' Title below posts?
New Landing › How can we help? › Themeforest Theme Support › Uplift › How to Change 'Related Articles' Title below posts?
- This topic has 3 replies, 2 voices, and was last updated 8 years by David Martin – Support.
Viewing 4 posts - 1 through 4 (of 4 total)
-
Posted in: Uplift
-
August 24, 2016 at 4:20 am #289043
Hi, how we we change ‘Related Articles’? Couldn’t find this in theme files. Thank you
August 24, 2016 at 8:29 am #289071Please install and activate the supplied child theme, inside the child theme
functions.php
file paste the below in.You can then change the below “Related Articles” to your desired.
/* POST RELATED ARTICLES ================================================== */ if ( ! function_exists( 'sf_post_related_articles' ) ) { function sf_post_related_articles() { $related_articles_class = apply_filters( 'sf_post_related_articles_wrap_class', 'container' ); $related_articles_display_type = apply_filters( 'sf_related_articles_display_type', 'bold' ); $related_articles_excerpt_length = apply_filters( 'sf_related_articles_excerpt_length', 20 ); $related_articles_count = apply_filters( 'sf_related_posts_count', 4 ); $related_articles_item_class = apply_filters( 'sf_related_posts_item_class', 'col-sm-3' ); $list_class = 'posts-type-'.$related_articles_display_type; if ($related_articles_display_type == "bold") { $list_class .= ' no-gutters'; } else { $list_class .= ' row'; } global $post; $args = array(); $tags = wp_get_post_tags( $post->ID ); $categories = get_the_category( $post->ID ); if ( ! empty( $tags ) ) { $tag_ids = array(); foreach ( $tags as $individual_tag ) { $tag_ids[] = $individual_tag->term_id; } $args = array( 'tag__in' => $tag_ids, 'post__not_in' => array( $post->ID ), 'posts_per_page' => $related_articles_count, // Number of related posts to display. 'ignore_sticky_posts' => 1 ); } else if ( ! empty( $categories ) ) { $category_ids = array(); foreach ( $categories as $individual_category ) { $category_ids[] = $individual_category->term_id; } $args = array( 'category__in' => $category_ids, 'post__not_in' => array( $post->ID ), 'posts_per_page' => $related_articles_count, // Number of related posts that will be shown. 'orderby' => 'rand' ); } $related_posts_query = new WP_Query( $args ); if ( $related_posts_query->have_posts() ) { echo '<div class="related-wrap">'; echo '<div class="related-articles ' . $related_articles_class . '">'; echo '<div class="title-wrap"><h3 class="spb-heading"><span>' . __( "Related Articles", 'uplift' ) . '</span></h3></div>'; echo '<div class=" recent-posts '.$list_class.' clearfix">'; while ( $related_posts_query->have_posts() ) : $related_posts_query->the_post(); echo sf_get_recent_post_item( $post, $related_articles_display_type, $related_articles_excerpt_length, $related_articles_item_class ); endwhile; echo '</div>'; echo '</div>'; echo '</div>'; } } add_action( 'sf_post_after_article', 'sf_post_related_articles', 10 ); }
August 24, 2016 at 9:06 am #289078Perfect, thanks David
August 24, 2016 at 10:18 am #289104Happy to help!
– David.
-
Posted in: Uplift
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in and have valid license to reply to this topic.