Home Forums Community Forum Portfolio Related Projects

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • spencermc
    Participant
    Post count: 3

    On a single portfolio post, where you have Related Projects at the bottom, is there a way to re-label it? Projects doesn’t really describe my “portfolio” items. I would like it to read “Related Content”. Any way to make this happen?

    dagovehoel
    Participant
    Post count: 1

    I solved it by adding this to the child-theme’s function.php:

    function avada_render_related_posts( $post_type = 'post' ) {
    	// Set the needed variables according to post type.
    	if ( 'post' === $post_type ) {
    		$theme_option_name = 'related_posts';
    		$main_heading      = esc_html__( 'Related Posts', 'Avada' );
    	} elseif ( 'avada_portfolio' === $post_type ) {
    		$theme_option_name = 'portfolio_related_posts';
    		$main_heading      = esc_html__( 'YOUR CUSTOM TITLE GOES HERE', 'Avada' );
    	} elseif ( 'avada_faq' === $post_type ) {
    		$theme_option_name = 'faq_related_posts';
    		$main_heading      = esc_html__( 'Related Faqs', 'Avada' );
    	}
    	// Check if related posts should be shown.
    	if ( isset( $theme_option_name ) && ( 'yes' === fusion_get_option( $theme_option_name, 'related_posts', get_the_ID() ) || '1' == fusion_get_option( $theme_option_name, 'related_posts', get_the_ID() ) ) ) {
    		$number_related_posts = Avada()->settings->get( 'number_related_posts' );
    		$number_related_posts = ( '0' == $number_related_posts ) ? '-1' : $number_related_posts;
    		if ( 'post' === $post_type ) {
    			$related_posts = fusion_get_related_posts( get_the_ID(), $number_related_posts );
    		} else {
    			$related_posts = fusion_get_custom_posttype_related_posts( get_the_ID(), $number_related_posts, $post_type );
    		}
    		// If there are related posts, display them.
    		if ( isset( $related_posts ) && $related_posts->have_posts() ) {
    			include wp_normalize_path( locate_template( 'templates/related-posts.php' ) );
    		}
    	}
    }

    It’s originally from the file avada-functions.php within the includes directory of the theme.

    teagads
    Participant
    Post count: 1

    This fix worked for me. Thanks! Would be helpful if it was customizable for various groupings of related posts. I have a section on my site for staff and another for board members. I’d love to be able to have one title read “Other Staff Members” and another read “Other Board Members” and have the flexibility for other instances of the related posts feature.

    paulad
    Participant
    Post count: 4

    This does a good job at changing the title 🙂 but removes the related posts leaving just the title.
    https://4648264ef921a9f283764a7965139582.p.myukcloud.com/catalogue-items/big-brother/

    I have fiddled with the code but no success. I don’t fully understand PHP so any help would be appreciated.

    I just dropped it below the last line: add_action( ‘after_setup_theme’, ‘avada_lang_setup’ );

    I have also tried adding this code top my child theme functions.php but no such either.

    https://github.com/webwolfhosting/Avada/blob/master/includes/avada-functions.php

    if ( ! function_exists( ‘avada_render_related_posts’ ) ) {
    /**
    * Render related posts carousel.
    *
    * @param string $post_type The post type to determine correct related posts and headings.
    * @return void Directly includes the template file.
    */
    function avada_render_related_posts( $post_type = ” ) {

    $post_id = get_the_ID();

    if ( ! $post_type ) {
    global $wp_query;
    $post_type = ‘post’;
    if ( is_object( $wp_query ) && isset( $wp_query->post ) && is_object( $wp_query->post ) && isset( $wp_query->post->ID ) && $wp_query->post->ID ) {
    $post_type = get_post_type( $wp_query->post->ID );
    $post_id = $wp_query->post->ID;
    }
    }

    // Set the needed variables according to post type.
    $main_heading = ”;
    if ( ‘post’ === $post_type ) {
    $theme_option_name = ‘related_posts’;
    $main_heading = esc_html__( ‘Related Posts’, ‘Avada’ );
    } elseif ( ‘avada_portfolio’ === $post_type ) {
    $theme_option_name = ‘portfolio_related_posts’;
    $main_heading = esc_html__( ‘Related Projects’, ‘Avada’ );
    } elseif ( ‘avada_faq’ === $post_type ) {
    $theme_option_name = ‘faq_related_posts’;
    $main_heading = esc_html__( ‘Related Faqs’, ‘Avada’ );
    }

    $main_heading = apply_filters( ‘fusion_related_posts_heading_text’, $main_heading, $post_type );

    // Check if related posts should be shown.
    if ( isset( $theme_option_name ) && ( fusion_get_option( $theme_option_name ) ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
    $number_related_posts = Avada()->settings->get( ‘number_related_posts’ );
    $number_related_posts = ( ‘0’ == $number_related_posts ) ? ‘-1’ : $number_related_posts; // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
    if ( ‘post’ === $post_type ) {
    $related_posts = fusion_get_related_posts( $post_id, $number_related_posts );
    } else {
    $related_posts = fusion_get_custom_posttype_related_posts( $post_id, $number_related_posts, $post_type );
    }

    // If there are related posts, display them.
    if ( isset( $related_posts ) && $related_posts->have_posts() ) {
    include wp_normalize_path( locate_template( ‘templates/related-posts.php’ ) );
    }
    }
    }
    }

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.