• Resolved Roman

    (@vladroman)


    Hello!

    WordPress 5.5.3
    OceanWP 2.0.2

    Have problem with displaying list of articles, wich have [more] in them. Any page: main, category, tag ect. Probably, bug of theme.

    OceanWP give ability to show in article list all content of article or fixed length in words. If there is no [more] in article, everything works as should. But if [more] exist in article, theme shows article content directly until [more]. Doesn’t matter, chosen to show all content or just 5 words. Doesn’t matter, where [more] in article: begin, middle, end. Anyway content shown until [more].

    This is problem for me, cause in article list I need to show article title and 10-15 words from article content. But theme shows me 50-70 words depending on [more] position in article. And my design goes to hell…

    The second problem with this: TWO “read more” links in article list for every article. First link-text “more” from [more], second button “more” from OceanWP ReadMore button. I can disable button in theme settings, but i like this button, it’s good. I just don’t need first link-text “more”.

    Any idea, how to fix this? Or submit bugreport to developers? I don’t want to delete [more] in all articles: I need it and it is a lot of job. ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Roman

    (@vladroman)

    Just found, this is not a bug, but theme feature. They have function, wich does this special.

    function oceanwp_excerpt( $length = 30 ) {
    		global $post;
    		$output = '';
    
    		// Check for custom excerpt
    		if ( isset( $post->ID ) && has_excerpt( $post->ID ) ) {
    			$output = $post->post_excerpt;
    		}
    
    		// No custom excerpt
    		elseif ( isset( $post->post_content ) ) {
    
    			// Check for more tag and return content if it exists
    			if ( strpos( $post->post_content, '<!--more-->' ) ) {
    				$output = apply_filters( 'the_content', get_the_content() );
    			}
    
    			// No more tag defined
    			else {
    				$output = wp_trim_words( strip_shortcodes( $post->post_content ), $length );
    			}
    
    		}
    
    		$output = apply_filters('oceanwp_excerpt', $output);
    
    		return $output;
    
    	}

    Absolutely disagree with this.

    If I need to show article content until [more] I can just disable length limit, and whole article will be shown until [more] (this why tag [more] is necessary in every article). It is simple logic and it works now in theme.

    But if I want, if I NEED to limit content output with some length for design reason, I should have ability to enter this limit and get content until it without depending on [more] or something else. This is simple logic too. But it isn’t works in theme.

    Looks like OceanWP developers think otherwise…

    Anyway, 2nd problem with TWO “read more” is absolutely sure a bug. There is no logic to show “read more” link and “read more” button one after one. ??

    Thread Starter Roman

    (@vladroman)

    Here is function edition, wich works like I think should be.

    function oceanwp_excerpt( $length = 30 ) {
    	global $post;
    	$output = '';
    
    	// Check for custom excerpt
    	if ( isset( $post->ID ) && has_excerpt( $post->ID ) ) {
    		$output = $post->post_excerpt;
    	}
    
    	// No custom excerpt
    	elseif ( isset( $post->post_content ) ) {
    		$output = wp_trim_words( strip_shortcodes( $post->post_content ), $length );
    	}
    
    	$output = apply_filters('oceanwp_excerpt', $output);
    	return $output;
    }
    Thread Starter Roman

    (@vladroman)

    If you agree with developers logic for generating excerpts, but just don’t want to have 2 links “read more”, change this:

    $output = apply_filters( ‘the_content’, get_the_content() );

    to this:

    $output = apply_filters( ‘the_content’, get_the_content(”) );

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[more] – problem with article list’ is closed to new replies.