Jump to content


Photo
- - - - -

Unwanted empty <p></p> markup


Best Answer Danny , 09 June 2013 - 12:08 PM

If you're using a shortcode for your gallery, wrap around with our [pl_raw] shortcode, this is the sole reason why this shortcode was created. The [pl_raw] stops Wordpress from adding <p></p> tags when using a linebreak.

 

So your code will look like this:

 

[pl-raw]

[gallery-shortcode]

[/pl_raw]

 

You can only use the [pl_raw]...[/pl_raw] shortcode once per page, using this should strip the <p></p> tag below your gallery.

 

Code used in the Wordpress editor - http://cl.ly/image/101i3J3k3A1I

 

No <p></p> - http://cl.ly/image/400w1g3F470y

 

Also can you please stop adding your URL address with [dot]com etc.. if you do not wish for your URLs to picked by search engines please use a service such as http://tinyurl.com/

 

Or add it via the code tags like this:

 
http://www.pagelines.com/
Go to the full post


  • Please log in to reply
13 replies to this topic

#1 Willem-Siebe Spoelstra

Willem-Siebe Spoelstra

    Super Member

  • Members
  • 228 posts
  • LocationAlmere
  • Country: Country Flag

Posted 05 June 2013 - 12:19 PM

Hi,

 

I have something I can't get solved, hope I will get some good insights here.

 

I have two pages that end with a gallery from WP. In one page there is an extra empty line with <p></p> which causes extra whitespace.

Please Login or Register to see this Hidden Content

.

The only difference I know of in the page where there are no unwanted I added some divs because of the pagelines grid system. I think I'm not the first one struggling with this, however I did not find a solution.

 

Kind regards,

 

Willem



#2 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 05 June 2013 - 01:40 PM

In your post html code do NOT add linebreaks, wordpress will convert them into <p>

 

so do not

do this

with your html



#3 Willem-Siebe Spoelstra

Willem-Siebe Spoelstra

    Super Member

  • Members
  • 228 posts
  • LocationAlmere
  • Country: Country Flag

Posted 05 June 2013 - 01:53 PM

Hi,

 

Sometimes there should be paragraphs, so that's a good thing, I just don't understand why it is addes after my gallery (the page ends with the shortcode for the gallery). There are no lines in my post html after this shortcode, so there is in my opinion nothing what wordpress can convert into <p>, but it is there :-(.

Please Login or Register to see this Hidden Content



#4 James B

James B

    Advocate

  • Members

  • 5126 posts
  • LocationSurrey - UK
  • Country: Country Flag

Posted 05 June 2013 - 09:15 PM

Ok the first link do you mean the gap between the gallery and the blue footer area? If so that shows in firebug that it's being created by padding on the .hentry class.

 

.hentry .hentry-pad {
    padding0 0 25px;
}

  • Willem-Siebe Spoelstra likes this

#5 Willem-Siebe Spoelstra

Willem-Siebe Spoelstra

    Super Member

  • Members
  • 228 posts
  • LocationAlmere
  • Country: Country Flag

Posted 06 June 2013 - 07:21 AM

Hi James B, I mean the gap between the gallery and the blue footer area, but the normal gap (link 2) is no problem and is caused by the CSS you mention, I already looked into that. However, the gap is bigger with the page from the first link. That is caused because of the unwanted P tags. Simon gave me some advice, but as you can read in my reply I don't do anything strange in my editor, so still need a solution.

 

Kind regards,

 

Willem



#6 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 06 June 2013 - 01:47 PM

Willem, 

 

James is correct, in his identification of the CSS element where the errant paragraph and closing paragraph appears.  It would seem that you may have added the gallery where a blank space existed or, hit carriage-return in error.   That would explain why it appears one place, and not another.

 

Can you tell me how you added the gallery?



#7 Willem-Siebe Spoelstra

Willem-Siebe Spoelstra

    Super Member

  • Members
  • 228 posts
  • LocationAlmere
  • Country: Country Flag

Posted 06 June 2013 - 03:47 PM

Hi Rob,

 

I did a test with two totally empty pages. I included a gallery in the WYSIWYG editor and the HTML editor, both resulting in an empty <p></p> line before and after the gallery.

You can check it on both pages: 

Please Login or Register to see this Hidden Content

This is really a mystery for me ;-).



#8 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 06 June 2013 - 04:05 PM

I'm still not sure how you're entering the gallery.  Is it a shortcode?



#9 Willem-Siebe Spoelstra

Willem-Siebe Spoelstra

    Super Member

  • Members
  • 228 posts
  • LocationAlmere
  • Country: Country Flag

Posted 07 June 2013 - 08:45 AM

Hi Rob, I insert it by clicking on the button just under the permalink: 'Insert media'. I use this button when am in the WYSIWYG-screen and when I'm in the HTML-screen.

The result of inserting a gallery is a shortcode which you can see in the HTML-screen. In the WYSIWYG-editor a blue field is visible where you inserted the gallery, but this correspondends with the shortcode ofcourse.

 

Hope I could clearify myself with this, if not please let me know as I'm eager to solve this problem ;-).

 

Kind regards,

 

Willem



#10 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 07 June 2013 - 01:16 PM

Willem I just did a test of inserting a gallery in two WordPress installations. 

 

One used PageLines Framework, the other Twenty Eleven, the default WP theme.

 

In both cases, there is an extra <p> and </p> inserted into the page below the gallery.  Thus I must conclude that since the gallery is actually a WordPress function, support for this must come from WordPress.  PageLines did not in any way add the extra paragraph tags.  I suspect they are there for a purpose, to allow you to label the gallery, which is one of the possible options in its settings.

 

There is no extra space, as I suspected there might be, in the Text mode.  I'd suggest therefore, that you post a question in the WordPress.org forums about this.

 

Apologies for the delays.


  • Willem-Siebe Spoelstra likes this

#11 Willem-Siebe Spoelstra

Willem-Siebe Spoelstra

    Super Member

  • Members
  • 228 posts
  • LocationAlmere
  • Country: Country Flag

Posted 08 June 2013 - 09:08 AM

Hi Rob, thanks for all your efforts! That you also did a test I really appreciate. I'm going to ask the question at WordPress.org.

 

Kind regards,

 

Willem 



#12 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 08 June 2013 - 02:03 PM

Anytime Willem.



#13 Danny

Danny

    Is Awesome!

  • Moderators
  • 17919 posts
  • LocationManchester, UK
  • Country: Country Flag

Posted 09 June 2013 - 12:08 PM   Best Answer

If you're using a shortcode for your gallery, wrap around with our [pl_raw] shortcode, this is the sole reason why this shortcode was created. The [pl_raw] stops Wordpress from adding <p></p> tags when using a linebreak.

 

So your code will look like this:

 

[pl-raw]

[gallery-shortcode]

[/pl_raw]

 

You can only use the [pl_raw]...[/pl_raw] shortcode once per page, using this should strip the <p></p> tag below your gallery.

 

Code used in the Wordpress editor - 

Please Login or Register to see this Hidden Content

 

No <p></p> - 

Please Login or Register to see this Hidden Content

 

Also can you please stop adding your URL address with [dot]com etc.. if you do not wish for your URLs to picked by search engines please use a service such as 

Please Login or Register to see this Hidden Content

 

Or add it via the code tags like this:

Please Login or Register to see this Hidden Content


  • Willem-Siebe Spoelstra likes this

#14 Willem-Siebe Spoelstra

Willem-Siebe Spoelstra

    Super Member

  • Members
  • 228 posts
  • LocationAlmere
  • Country: Country Flag

Posted 10 June 2013 - 06:48 AM

Hi Danny,

 

Also a big thank you for your efforts and a solution ofcourse.

The links were a big problem for me because I'm working on a temporary URL that should not be picked up by searchengines. Thanks for the tips, I also changed it already in this thread (with the code solution).

 

Kind regards,

 

Willem