Support » Theme: Hueman » How to remove or disable Related Posts function

  • Resolved MicCheckOne

    (@miccheckone)


    Hello all.

    How do I completely remove/disable the Related Posts function from the Hueman theme? I tried to do this via my child theme stylesheet, like so:

    .related-posts { display: none; }

    This removed the actual links/thumbnails to related posts, but the related posts heading (“You May Also Like…”) still appears. You can see the problem here.

    I’m guessing that I need to modify some code in the functions.php file, but I’m clueless about PHP. How do I remove, or disable, or comment-out, this function?

    /*  Related posts
    /* ------------------------------------ */
    if ( ! function_exists( 'alx_related_posts' ) ) {
    
    	function alx_related_posts() {
    		wp_reset_postdata();
    		global $post;
    
    		// Define shared post arguments
    		$args = array(
    			'no_found_rows'				=> true,
    			'update_post_meta_cache'	=> false,
    			'update_post_term_cache'	=> false,
    			'ignore_sticky_posts'		=> 1,
    			'orderby'					=> 'rand',
    			'post__not_in'				=> array($post->ID),
    			'posts_per_page'			=> 3
    		);
    		// Related by categories
    		if ( ot_get_option('related-posts') == 'categories' ) {
    
    			$cats = get_post_meta($post->ID, 'related-cat', true);
    
    			if ( !$cats ) {
    				$cats = wp_get_post_categories($post->ID, array('fields'=>'ids'));
    				$args['category__in'] = $cats;
    			} else {
    				$args['cat'] = $cats;
    			}
    		}
    		// Related by tags
    		if ( ot_get_option('related-posts') == 'tags' ) {
    
    			$tags = get_post_meta($post->ID, 'related-tag', true);
    
    			if ( !$tags ) {
    				$tags = wp_get_post_tags($post->ID, array('fields'=>'ids'));
    				$args['tag__in'] = $tags;
    			} else {
    				$args['tag_slug__in'] = explode(',', $tags);
    			}
    			if ( !$tags ) { $break = true; }
    		}
    
    		$query = !isset($break)?new WP_Query($args):new WP_Query;
    		return $query;
    	}
    
    }

    Thank you in advance!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi!

    Theme Options > Blog > Single – Related Posts > Off

    And there you go!

    Wow, I was making that way too complicated.

    Thank you, Alexander! This theme is awesome. You spoil us.

    Hi, same issue but I don’t see this option at all under blog posts… if I go to customize theme (PS I’m using WordPress 3.9.1 and Focus 1.0.8 made into a child theme) and look under “blog settings”, I see only two settings- “select category” and “number of posts per page”.

    where is this “Theme Options > Blog > Single – Related Posts > Off” supposed to be? I also looked under Settings > reading. Thanks

    It’s under the generic WordPress menu ‘Appearance’ in the admin console.
    Then look for ‘Theme Options’
    Then look for the ‘tab’ called ‘Blog’
    Then scroll down and it’s second option from the end called “Single — Related Posts”… “Shows randomized related articles below the post”

    I am having the same need: I am using profitmag, all the above solutions are not applied to this theme, I wonder there is the backend code for generating “related post” section in the page, I checked page.php and there is no “related post”

    Moderator bdbrown

    (@bdbrown)

    Hi mdivk. This thread is six months old and has been marked as Resolved. Please start a new topic here: https://wordpress.org/support/theme/hueman#postform. You can reference this post if needed.Thank you.

    WPyogi

    (@wpyogi)

    Forum Moderator

    @mdivk – you are not using this theme – you need to post on the forum for the theme you are using – here:

    https://wordpress.org/support/theme/profitmag#postform

    Moderator bdbrown

    (@bdbrown)

    @wpyogi. Missed that; thanks.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to remove or disable Related Posts function’ is closed to new replies.