0
votes

I'm working on a wordpress website. I would like to know how to add a new div id or class in the_content loop for posts. That is, I don't want to add any html in the post edit area of the backend; what I want is to actually create a new div or class in the post, so that I have an img and then the text wrapped within a div.

In my posts I need to wrap the text paragraphs in a div, like so:

<div class="entry-content">
<p><....img...></p>
<div class="text">
<p>text</p>
<p>text</p>
<p>text</p>
<p>text</p>
</div>
</div>

The div "text" is what I need to include. Could someone help me with this? I imagine I have to add something in the loop in function.php

thanks!

1

1 Answers

0
votes

Generaly, you do not edit post content in the template, you just display it.

So to do this, you need to use Format option to add a "Title 1" or anything content related style to some text in the visual editor.

If you really want to add specific tag, use shortag annotation (or find a plugin to do this)?

If you just wqant to have an image asigned to a post, check the thumbnails feature of wordpress that let you get the post image from outside the content.

BTW : you should consider posting wordpress question on https://wordpress.stackexchange.com/