[Plugin: PostLists] How to remove p tags around my list ? (2 posts)

  1. ircf
    Posted 6 years ago #


    This is a wonderful plugin, I only have a little problem :

    I created a list (let's call it "mylist") with a div opening tag before the first entry and a div closing tag after the last entry. The problem is when i use my list in a page like this :

    My text before list
    My text after list

    WordPress will automatically wrap my list (and so my div) in a paragraph.

    My site won't validate XHTML 1.0 and I really need it to... Can anyone help please ?


  2. ircf
    Posted 6 years ago #

    As this is a WP more general issue, i solved it using a filter on the_content in functions.php :

    function custom_fix_paragraph($content){
    	$content = str_replace ('<p><div','<div',$content);
    	$content = str_replace ('</div></p>','</div>',$content);
    	return $content;
    add_filter('the_content', 'custom_fix_paragraph');

    For this to work with postlists, i had to remove the author comment (sorry), because it was added between the p and the div opening tags.

Topic Closed

This topic has been closed to new replies.

About this Topic