Forums

Add Div to post or page (7 posts)

  1. cclinton
    Member
    Posted 4 years ago #

    Every so often I want to add something special like a right floated DIV to a post. I already have the style sheet set up for the DIV and then type DIV into the code of the post with the class name that matches the style sheet. When I save the page WordPress removes the opening and closing Div code and leaves the stuff in the middle.
    Example:
    <div class="right">chicken</div> turns into chicken

    I also tried entering this:
    <div align="right">chicken</div> and I get:
    <p align="right">chicken</p>

    Any ideas?

  2. srikat
    Member
    Posted 4 years ago #

    Try disabling the visual editor.

  3. cclinton
    Member
    Posted 4 years ago #

    I did that and entered this:
    <div class="righty">chicken</div>
    and saved the page. When I saved the page it removed the class=righty portion and I was left with:
    <div>chicken</div>

  4. macsoft3
    Member
    Posted 4 years ago #

    You may want to search the forum. I already mentioned how to do it in or before Jan 14.

  5. cclinton
    Member
    Posted 4 years ago #

    macsoft3,
    I checked your previous posts around that time and couldn't find anything. I have also checked all over the forum and could not find a solution. This was the reason I started this topic.
    I'd really appreciate it if you could add a link to the post that you mentioned that solves this issue.

  6. cclinton
    Member
    Posted 4 years ago #

    Anyone have any ideas? I still have trouble adding Div's to posts.

  7. dditges
    Member
    Posted 3 years ago #

    This should answer your question as long as you aren't using 2.5 or higher. I think the code has moved to a different location.

    http://blog.mcstudios.net/2007/03/19/fixing-wordpress-editor-removing-div-tags

Topic Closed

This topic has been closed to new replies.

About this Topic