Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter espaconline

    (@espaconline)

    Hi George,

    Thanks for your response.

    It’s not to hide ads but to hide content.

    Imagine that I have 1000+ articles and I want to put your code on the 3 paragraph, the best way is… edit all articles?

    I′m working on this code…

    <?php
    $show_after_p = 2;
    $content = apply_filters('the_content', $post->post_content);
    if(substr_count($content, '<p>') > $show_after_p)
    {
    	$contents = explode("</p>", $content);
    	$p_count = 1;
    	foreach($contents as $content)
    	{
    		echo $content;
    		if($p_count == $show_after_p)
    		{
    		?>
    <?php echo do_shortcode( ' [read more="Ver Más Imágenes" less="Read Less"] ' ); ?>
    		<?php
    		}
    		echo "</p>";
    		$p_count++;
    	}
    }
    ?><?php echo do_shortcode( ' [/read] ' ); ?>

    Can you help me ?

    • This reply was modified 8 years, 4 months ago by espaconline.
    • This reply was modified 8 years, 4 months ago by espaconline.

    Same problem here…

    Did you find another solution?

Viewing 2 replies - 1 through 2 (of 2 total)