New Landing How can we help? Themeforest Theme Support Uplift “More Projects” also suggets active portfolio-item

Viewing 4 posts - 1 through 4 (of 4 total)
  • Posted in: Uplift
  • #296131
    oliverr
    Member
    Post count: 123

    Hey guys,
    I think it’s odd that “More Projects” at the end of a portfolio-item does also suggest the project that is currently opened in your browser. Is it possible to turn this off?

    Attachments:
    You must be logged in to view attached files.
    #296492
    David Martin – Support
    Moderator
    Post count: 20834

    Please install and activate the supplied child theme, inside the child theme functions.php file paste this:

        /* PORTFOLIO RELATED POSTS
        ================================================== */
        function sf_portfolio_related_posts( $post_id, $item_count = 3 ) {
            
            $query = new WP_Query();
            $terms = wp_get_object_terms( $post_id, 'portfolio-category' );
            if ( count( $terms ) ) {
            	$post_ids = array();
            	$term_categories = array();
            	
            	foreach ($terms as $term) {
            		$term_categories[] = $term->term_id;
            		$term_objects = get_objects_in_term( $term->term_id, 'portfolio-category' );
            		foreach ($term_objects as $object) {
            			$post_ids[] = $object;
            		}
            	}
    
                foreach (array_keys($post_ids, $post_id) as $key) {
                    unset($post_ids[$key]);
                }
                    
                $args  = array(
                    'post_type'         => 'portfolio',
                    'post__in'	        => $post_ids,
                    'posts_per_page'    => $item_count
                );
                $query = new WP_Query( $args );
            }
    
            // Return our results in query form
            return $query;
        }
    #325736
    focusingresources
    Member
    Post count: 76

    Will this code turn off the More Portfolio items completely?
    Thanks,
    Maggie

    #325764
    David Martin – Support
    Moderator
    Post count: 20834

    No, there is nothing in the code or anything mentioned above that would do or suggest that.

    Thanks.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register