• Resolved inextable

    (@inextable)


    Hi!
    I like a lot your plugin and I would love to use it in my site but I don’t know how to solve this issue.
    I’m using a theme called Avada which it comes with a builder included.
    When I try to create a Posts slider and I write “content”, html content is not loaded, but builder code is loaded.
    Is there any way to load normal html code?
    Thanks very much

    The page I need help with: [log in to see the link]

Viewing 5 replies - 16 through 20 (of 20 total)
  • Plugin Author rameez_iqbal

    (@rameez_iqbal)

    Please try this code

    add_filter( 'rpc_display_meta_data', 'rpc_change_content', 10, 5 );
    
    function rpc_change_content($display, $post_id, $key, $length, $carousel_settings){
    	if ($key == 'content') {
    		ob_start();
    		$content = do_shortcode( get_the_content($post_id) );
    		echo rpc_limit_text($content, $length);
    		return ob_get_clean();
    	}
    	return $display;
    }
    
    function rpc_limit_text($text, $limit) {
          if (str_word_count($text, 0) > $limit) {
              $words = str_word_count($text, 2);
              $pos = array_keys($words);
              $text = substr($text, 0, $pos[$limit]) . '...';
          }
          return $text;
    }
    Thread Starter inextable

    (@inextable)

    Hi!
    Ouch, now it’s broken ?? All slides are shown inside the first slide

    Plugin Author rameez_iqbal

    (@rameez_iqbal)

    Well, you have to increase the Maximum Words limit to cover all the closing tags also.

    Let me understand you,

    Suppose your markup contains heading tags, like this

    <h2>Hello There! Its a long heading</h2>

    Now, when you will trim it to display 5 words, this will happen

    <h2>Hello There! Its a

    It means, the heading tag never closed, disturbs the whole layout. Exactly this is happening in your case with some divs. You have to be very careful setting the Maximum Words length.
    That’s why we’re stripping the HTML tags in the slider contents as it’s a possibility that it can break the whole page.

    I hope you understand this.

    Regards

    Thread Starter inextable

    (@inextable)

    Mmmmm… Ok, I see… then is it not possible? There allways will be an end of a tag like a /p or a /div. Isn’t there a way to force a close?
    Now First slide is ok (it shows full content) but second and third are broken (I gues it’s because they have more content than maximum words lengh)
    What about excerpt? Is it possible to not strip html in custom excerpt? It’s much easier to control content lengh in custom excerpt (because there’s not a builder but a normal editor)

    Plugin Author rameez_iqbal

    (@rameez_iqbal)

    The following code will enable it for the excerpt also

    add_filter( 'rpc_display_meta_data', 'rpc_change_content', 10, 5 );
    
    function rpc_change_content($display, $post_id, $key, $length, $carousel_settings){
    	if ($key == 'content' || $key == 'excerpt') {
    		ob_start();
    		echo do_shortcode( get_the_content($post_id) );
    		return ob_get_clean();
    	}
    	return $display;
    }
Viewing 5 replies - 16 through 20 (of 20 total)
  • The topic ‘Content doesn’t display ok if I use a builder’ is closed to new replies.