WordPress.org

Ready to get started?Download WordPress

Forums

HMTL in pages (8 posts)

  1. psiweb
    Member
    Posted 1 year ago #

    We are working on rebuilding our company website and I am considering using wordpress as a CMS.

    I currently have a working version of the site built using my own html, php, and css the problem I am running into is I am having to put a lot of html tags, for classes and things of this nature, for instance I have a 12 column grid layout, I want one column to take up half the page and the another column to take up the other half, currently I just put a class name on the div to make this happen, no problem if you know how html and css work.

    I am worried that if I have to put this html and css tags into the post or page I create with wordpress someone who doesn't know html and css would come along and accidentally mess things up. What I am wondering is if there is anyway around this, I am sure its not the first time something like this has happened, please let me know what solutions I should look into.

    Any help would be greatly appreciated.

  2. You can disable the "HTML" tab from appearing in the content editor at all. Then, no one can mess with the class names or the CSS. All adjustments would need to be made with the "Visual" editor.

  3. Peter Wooster
    Member
    Posted 1 year ago #

    Actually, the visual editor will make things worse, the use won't be able to see your divs and will delete them inadvertently.

    What I do is add a bunch of shortcodes that let me define blocks with classes and ids. Since these are shortcodes they are visible to the user and they can edit the posts with the visual editor, and know to leave the blocks alone.

    I haven't made a plugin out of this, but I probably should as I use it in almost every site I build.

  4. psiweb
    Member
    Posted 1 year ago #

    Yes I was afraid of turning of the html editor altogether as well. I haven't looked into shortcodes much but it sounds like this might be a good solution for what I am looking for, thanks I will check it out.

    Also is common to put a lot of html code in the pages and posts or is it something people try to steer clear from? Or does it just depend?

  5. I guess it would depend on who you want to have access to the html. But, as Peter suggested, hiding all the HTML you don't want users to see into a shortcode is a good solution.

    On my site, I'm the ONLY user... so ALL my pages contain the HTML. It would be an unnecessary extra step for me to use shortcodes.

    However, if I had dozens of other users who did not know HTML.. I would def use Peter's suggestion.

  6. psiweb
    Member
    Posted 1 year ago #

    Thanks for the feedback, I think you are right if it were only me updating it there would be no problem, but since there could potentially be many people down the road who use it this might be a good way to lock down some of the pages and the code.

    Is this a common solution? I am fairly new to wordpres so want to make sure I am following best practices.

  7. Peter Wooster
    Member
    Posted 1 year ago #

    Wrapping HTML snippets in short codes is a best practice. This way non-programmers can use them with less chance of breaking things. I always aim to allow uses to edit in the visual editor.If I'm forced to require them to use the HTML editor, I start thinking about a non-WordPress solution. A CMS is intended to make content editing easy for end uses.

  8. psiweb
    Member
    Posted 1 year ago #

    Thanks everyone for the replies and advice, I am going to work on the shortcodes.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.