Grow your CSS skills. Land your dream job.

WPautop messing with WordPress shortcodes

  • # September 27, 2011 at 10:22 am

    Hi guys

    We’ve recently created a simple set of shortcodes for our clients, so that they can add FAQs to their site.

    The reason we chose shortcodes over a custom post type, is that CTP’s don’t allow for a custom order – as in not alphabetical, not ascending, not descending, not by date, but a custom human order.

    Anyway, we created the following:

    • [faqs]
    • [question]
    • [answer]

    [faqs] renders the opening and closing tags of a definition list (dl).

    [question] renders the definition title (dt).

    [answer] renders the definition description (dd).

    Obviously, semantically, we don’t want WordPress’s auto-p function to wrap the shortcodes with (p)’s, but we also don’t want to strip of the p tags, as an answer (definition description) can be made up of paragraphs and lists, etc.

    What’s the best way to go here? How do we stop WordPress from wrapping shortcodes with paragraph tags?

    By the way, I am already using TinyMCE advanced.

    Thanks in advance.

    Jon

    # October 12, 2011 at 8:32 am

    Anyone??

    # October 12, 2011 at 1:00 pm

    You could try something like this: http://www.simonbattersby.com/blog/2011/02/wordpress-wrapping-shortcodes-with-p-tags/

    There seems to be quite a few other results in Google and on the WordPress forums.

    # June 25, 2012 at 11:20 pm

    Regarding custom post types ordering, another alternative is to use menu_order. Just include ‘page_attributes’ when you register the post type. The CMS tree page view plugin is nifty for dragging the items into the desired order.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".