I’m working on a theme and have run across a problem that I can’t solve. It concerns the automatic insertion of paragraph tags at the top and bottom of the content. The effect I’m trying to achieve is as follows,
Blog title. First line of content.
I don’t want a new paragraph for the content. Instead I want the content to start on the same line as the title. But Wordpress insists on putting a paragraph tag before the content making it seemingly impossible to make the title and content appear inline. Even the liberal application of display: inline can’t stop Wordpress from inserting the paragraph tag.
There is a plugin available which disables the auto formatting of the content but this also removes the paragraph tags that are required, between paragraphs in the content for instance. That makes the content virtually unreadable.
Any ideas?








One Trackback
10 Comments
Ashley, I’m no CSS wizard, but two things come to mind. One, you could try to use a “display: run-in;” on your h2 heading, or whatever you’re using for your titles. I’m not sure if this declaration is cross browser supported however. Another option might be to “float: left;” the title and try styling it as you like.
Anyway, the two thoughts that come immediately to mind. I’ll bet someone with more knowledge will pop up with something better, but you could give these two approaches a shot and see if they work.
Off the top of my head, I can only suggest a “hack” solution. Try setting the margins to “0″ for paragraphs within the header div.
I agree that it would be best to remove the tags altogether. There might be a way to do it with the :before and “after pseudo-elements. If you want, you can email me the files and I’ll see if I can’t figure something out. I’m really still learning myself, but I love a good challenge.
hello.
you can manually “override” the first paragraph by adding it manually like or surround it in a div which will prevent wordpress from adding the paragraph tags. you could then style the p or div and force it to show up there, maybe float it left.
hope that helps.
right, it didn’t show the the p tag. it was a paragraph with an associated class. hopefully you’ll understand what i meant.
hey bro shoot me an example of what youve got so far. i’ll see what i can do with the css. it shouldn’t be too hard o remove the line break. if the line break isn’t the issue, use a negative padding/margin. *shrug* hit me up.
on a personal note, i worked on the network of a bad-ass jazz/rock guitarist from Charleston, SC. i mentioned your site.
curt, admin real sports bloggers network
You might try…
.entry-title {
display:inline;
margin-right:.125em;
float:left;
}
.entry-title + p, .entry-title + anythingelse {
display:inline;
float:left;
}
Thanks for all the help. I’m going to get my head stuck in the code and try each of the solutions in turn.
Curt and Andrew - Thanks, if I get stuck I’ll contact you directly and send you a wordpress login so you can both get stuck in if you want to. I’ll set up two installations so you can both play with the CSS without bumping into each other.
Curt - Thanks for the mention. What’s the URL of the jazz site? I’d like to take a look
If all else fails I could probably get away moving the titles to the content meta section. That way they wouldn’t mess up the minimalist feel.
Ashley, try cracking open the style.css file in the UB Modicus theme. In it, you’ll find
.entry p:first-child xxxxxxxxwhich styles the first paragraph of content. Just a thought.If you float:left both items (title and content) you should get them onto the same line. Just ensure that htey both use the same lineheight else you might run into some ugliness.
you’ll need to modify the page source in your template wp-content>themes>yours>page.php single php etc.. b/c title and content are pulled by two php calls. I can fix and i would suggest and update to at least wp2.5 or 2.3 2.1 has some security issues.