You can use shortcode function to do this.
function accordion_shortcode( $atts, $content = null ) {
extract( shortcode_atts( array(
'class' => 'accordion',
), $atts ) );
return '<div class="' . esc_attr($class) . '">' . $content . '</div>';
}
add_shortcode( 'accordion', 'accordion_shortcode' );
In editor you wrap your content:
[accordion]
<h3>Headline 1</h3>
<p>Content.. lorem ipsum</p>
<h3>Headline 2</h3>
<p>Content.. lorem ipsum</p>
<h3>Headline 3</h3>
<p>Content.. lorem ipsum</p>
[/accordion]
Related Posts:
- jQuery dialog popup
- How to change the text of a button in jQuery?
- jQueryUI dialog width
- How to use radio on change event?
- Form Submit jQuery does not work
- Slide right to left?
- Check if user is logged in using JQuery
- How to save the state of a drag and drop jQuery UI Sortables front end layout editor?
- jQuery UI Datepicker not working
- Custom function to rearrange attachments when creating posts – Almost there
- possible to make sections in theme customizer sortable and saveable at publish button clicked?
- Enqueuing jQuery in plug-ins
- How do I get my page to load the jQuery UI Effects library?
- Override default jquery ui library with newer version
- How to enable the content editor as a droppable target with jQuery-ui?
- Jquery not showing in homepage
- Format numeric symbols in titles
- jQuery.accordion isn’t a function even when enqueued
- Override theme style with other CSS on a specific page
- Will the latest Bootstrap work properly with the default WordPress jQuery?
- Rhyzz Repeatable-fields javascript in php and wordpress
- WordPress + BlockUI or a splash page [closed]
- Return an array from get_terms and store as JavaScript array for search autocomplete
- Dukapress jQuery(“form.product_update”).livequery is not a function [closed]
- Which jQuery packages are included in WordPress 3.1.2?
- Good Solution for Adding jQuery Tabs Anywhere Within WordPress?
- Cannot enqueue jQuery correctly using Google CDN
- Adding jQuery UI elements to WordPress page
- Sorting WP Auctions by date/price?
- How to add custon UI jquery & Fancybox script to WP
- jQuery tabs plugin with callback to fetch data
- Jquery UI Google CSS, from where?
- datepicker for custom post type admin
- JQuery UI not loading without explicit loading of jQuery
- Is there a default way in wordpress to create a overlay in the dashboard?
- AJAX Success Function using JS substr() fails in WP 4.1 vs 4.0
- Recommended Use of Bootstrap, or JQuery-UI in WP/plugin development?
- Screen Options JavaScript Code
- Drag and Drop Metadata Menu Order
- A carousel slideshow plugin in JavaScript
- jQuery UI Accordion loading very slow
- Theme style overrides the plugin style
- Slide toggle Jquery UI
- jquery Autocomplete
- why does so many javascript libraries are loaded along with my website?
- Dashboard controls have all stopped working
- How can I add a new lib path without call each one on the header?
- Sorting UL Listing Within the TinyMCE Visual Editor in WordPress
- jQuery dialog prints HTML-Tags under WordPress
- using jquery autocomplete in wordpress plugin
- Theme variation conflict with jquery select2 dropdown
- jQuery datepicker not showing on admin menu
- JavaScript: filter() for Objects
- jQuery date formatting
- How to center image in carousel
- How to remove specific value from array using jQuery
- Check if jquery library exist
- Access Customizer’s DOM – jQuery
- Media manager multiple selection
- How to include jQuery properly?
- How to load whole WordPress pages dynamically with AJAX/jQuery like this following website?
- Creating custom AJAX requests
- trigger(‘change’) not working
- Gravity list field override and adding javascript [closed]
- wp_verify_nonce not working
- Load created php file data via ajax
- Is it necessary to enqueue jquery?
- Displaying div from custom-post-type in Fancy Box
- NextGen plugin check failing, why?
- On screen music/audio player that grabs track URL [closed]
- WP http XML response HTML encoding and image display problems
- Using WP_Query to grab custom meta values, foreach to json object
- Do we have to santise html passing into Javascript ? How?
- Prevent other versions of jquery from loading on static front page
- jQuery will not work on page from snippet or file
- How to keep HTML form field that is conditional hidden with javasript hidden after page reload?
- Accessing javascript in multiple files [closed]
- Issues loading Jquery on WordPress website
- Script not loading when depending on jQuery
- masonry only works if jquery is called twice
- No Object Properties sending form through AJAX
- Redirect wp_dropdown_pages() to an AJax request?
- Parse wordpress blog data using json api and ajax
- JQuery Issues With WordPress Theme Interface
- AJAX calendar navigation returns -1
- How to setup multi-page using jquery?
- $ not defined using jQuery in WordPress
- Get with jQuery the value of an ACF field
- I want to run Sql Query in script how can i do this
- error: n.imagesLoaded is not a function
- How to change event in slider
- Can’t seem to get JQuery working (wordpress plugin)
- slide change on hover with nextgen scrollgallery [closed]
- jQuery .change() Event Bubbling in WP Admin
- Unable to understand this jquery code [closed]
- Combo box populating a DIV using ajax/jquery
- can’t make jQuery work (change image on time interval) [closed]
- Fire an event after Featured Image selection
- Elementor form – checkboxes validation
- How to add input file plain text and submit to publish?