I’m using the code editor (not the visual editor) and the wpautop function is inserting a closing paragraph tag inside the blockquote tag, but not an opening tag, thus rendering my html invalid.
Does anybody knows how to fix this?
This is doing my head in.
Try typing it all on one line including the p tags:
<blockquote><p>This is a quote</p></blockquote>
Hope it works. 🙂
Thanks for the reply. I was typing blockquote alone, wp was inserting the closing </p> I have fixed by editing the quicktag.js
Hi, can you share your edited quicktag.js? That may come in handy..
Thank you very much..
This is also causing me a lot of problems. I’m not sure what to do with quicktags.js and am concerned that if I just add an opening and closing p element to lines 63 and 64 I will potentially cause more issues.
In my mind it boils down to TinyMCE refusing to show the p element when in code view.
So, if I attempt to force the correct behaviour for a blockquote, eg:
<blockquote> <p>First line of blockquote</p> <p>Second Line</p> </blockquote>
It persists in reformatting this to a variety of things, dependent on whether I save instantly or switch to the visual editor.
Usually returning to code view shows something like:
<blockquote>First line of blockquote Second Line </blockquote>
and this renders in a variety of ways. It’s quite frustrating and whether I end up with the extra </p> or not, I am still getting validation errors that make it clear that the text within the blockquote must be contained within a block level element, such as a p or div element. I attempted to add a div element, but again TinyMCE persists in removing these and making life a little more difficult.
Whilst I was writing that last post, the thought occurred to me that I can force TinyMCE to behave a little by adding a class to a p element.
So, for example:
<blockquote> <p class="qp">First line of blockquote</p> <p class="qp">Second Line</p> </blockquote>
The above code will force the editor to keep your p elements intact.
This is a temporary fix in my mind, as the site I am working on will eventually be maintained by non-coders who will not be likely to use this method to force the correct behaviour. Resulting in a strong likelihood that pages will fail to validate again.
On a side note I attempted to wrap everything within the blockquote in a div element to give me an extra hook for my css.
It converted it to:
<blockquote> <p class="q-inner"> </p> <p class="qp">First line of blockquote</p> <p class="qp">Second Line</p> </div> </blockquote>
or something equally ridiculous! I’ll get round it by using additional classes on the final p element in the blockquote.
Thought this might be of some help.
The <p> tag inside blockquote is a valid markup.
schematic blockquote should look like the following
You could used CSS to make the paragraph flow inside blockquote
<blockquote cite="http//reference.com/context-excerpt"> <p>The Excerpt</p> </blockquote>
Possibly I didn’t make my point entirely clear. I can’t remember all of the problems that I was having before, but it was primarily that in certain situations WordPress wasn’t putting the correct p elements in place.
Items inside a
<blockquote>must be contained by block level elements. I think the problem that I was finding was that WordPress was not putting the first sentence of a blockquote in a p element. Rendering something like:
<blockquote>Your first sentence <p>Your second sentence</p> </blockquote>
I’m not sure if this is 100% correct as I’m just going off the top of my head here. This is why I was suggesting that you can get more control over blockquotes by adding classes to the p elements within a blockquote (and this also has the added advantage of giving you a few extra hooks for styling purposes).
You can see an example of how I ended up coding things at this link – http://www.gbv.ie/about-the-consortium/
By using classes qp and qp-last, I was able to style things nicely. Class ‘qp-last’ allows me to place a background “end quote” image. If the code view in word press just showed all of the p elements I think things would make more sense.
I wish that there was an advanced code view option that you could tick which would turn off the current hybrid code view situation that currently exists. It’s a little infuriating at the moment!
I have this blog http://www.cdisol.com-Doctor Away in which when i am checking it through any validator link I am getting so many errors… I have not mnaupulated anything in the header it is the default that wordpress gave so why are there so many errors.. And what do i do of them
- The topic ‘</p> tag before </blockquote>’ is closed to new replies.