Skip to content

Instantly share code, notes, and snippets.

@wpmark
Created May 6, 2015 18:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wpmark/06937f9baca8d80a1add to your computer and use it in GitHub Desktop.
Save wpmark/06937f9baca8d80a1add to your computer and use it in GitHub Desktop.
Register Shortcode with Shortcode UI
<?php
/**
* function wpmark_register_before_after_shortcake()
*/
function wpmark_register_before_after_shortcake() {
shortcode_ui_register_for_shortcode(
'before_after_image', // name of shortcode ui
array(
'label' => 'Before After Image',
'listItemImage' => 'dashicons-format-image',
'attrs' => array(
array(
'label' => 'Title',
'attr' => 'title',
'type' => 'text',
'description' => 'Enter a title for this before/after image',
),
array(
'label' => 'Before Image',
'attr' => 'before_image',
'type' => 'attachment',
'description' => 'Choose/Upload an image for the before image. This should be at least 634px wide and the same size as the after image.',
),
array(
'label' => 'After Image',
'attr' => 'after_image',
'type' => 'attachment',
'description' => 'Choose/Upload an image for the after image. This should be at least 634px wide and the same size as the before image.',
),
array(
'label' => 'Description',
'attr' => 'description',
'type' => 'textarea',
'description' => 'Enter a description for this before/after image',
),
),
)
);
}
add_action( 'init', 'wpmark_register_before_after_shortcake' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment