示例#1
0
 *
 * @since      1.0.0
 *
 * @package    Render
 * @subpackage Shortcodes
 */
// Exit if loaded directly
if (!defined('ABSPATH')) {
    die;
}
// Loops through each shortcode and adds it to Render
foreach (array(array('code' => 'render_accordion_wrapper', 'function' => '_render_sc_accordion_wrapper', 'title' => __('Accordion', 'Render'), 'description' => __('An accordion style drop-down for hiding and revealing content.', 'Render'), 'atts' => array('start_closed' => array('label' => __('Load Closed', 'Render'), 'type' => 'checkbox', 'properties' => array('value' => 'true', 'label' => __('Load the accordion with all sections collapsed', 'Render'))), array('label' => __('Colors', 'Render'), 'type' => 'section_break'), 'heading_background' => array('label' => __('Heading', 'Render'), 'type' => 'colorpicker', 'default' => RENDER_PRIMARY_COLOR), 'heading_background_hover' => array('label' => __('Heading Hover', 'Render'), 'type' => 'colorpicker', 'default' => RENDER_PRIMARY_COLOR_DARK), 'heading_font_color' => array('label' => __('Heading Font', 'Render'), 'type' => 'colorpicker', 'default' => RENDER_PRIMARY_FONT_COLOR), array('label' => __('Accordion Sections', 'Render'), 'type' => 'section_break'), 'nested_children' => array('label' => false, 'type' => 'repeater', 'properties' => array('fields' => array(array('label' => __('Accordion Section', 'Render'), 'type' => 'placeholder'), 'heading' => array('label' => __('Heading', 'Render'), 'required' => true))))), 'wrapping' => true, 'render' => array('nested' => array('child' => 'render_accordion_section', 'globalAtts' => array('heading_background', 'heading_background_hover', 'heading_font_color')), 'displayBlock' => true)), array('code' => 'render_accordion_section', 'function' => '_render_sc_accordion_section', 'noDisplay' => true, 'wrapping' => true, 'render' => array('nested' => array('parent' => 'render_accordion_wrapper'), 'dummyContent' => '(Enter accordion section content here)', 'noStyle' => true, 'displayBlock' => true)), array('code' => 'render_button', 'function' => '_render_sc_button', 'title' => __('Button', 'Render'), 'description' => __('Creates a sweet button.', 'Render'), 'atts' => array(array('type' => 'section_break', 'label' => __('Colors', 'Render')), 'color' => array('label' => __('Background', 'Render'), 'type' => 'colorpicker', 'default' => RENDER_PRIMARY_COLOR), 'color_hover' => array('label' => __('Background (Hover)', 'Render'), 'type' => 'colorpicker', 'default' => RENDER_PRIMARY_COLOR_DARK), 'font_color' => array('label' => __('Font', 'Render'), 'type' => 'colorpicker', 'default' => RENDER_PRIMARY_FONT_COLOR), array('type' => 'section_break', 'label' => __('Visual', 'Render')), 'size' => array('label' => __('Size', 'Render'), 'type' => 'selectbox', 'properties' => array('placeholder' => __('Medium', 'Render'), 'options' => array('large' => __('Large', 'Render'), 'medium' => __('Medium', 'Render'), 'small' => __('Small', 'Render')))), 'shape' => array('label' => __('Shape', 'Render'), 'type' => 'selectbox', 'properties' => array('placeholder' => __('Rectangle', 'Render'), 'options' => array('rectangle' => __('Rectangle', 'Render'), 'rounded' => __('Rounded', 'Render'), 'ellipse' => __('Ellipse', 'Render')))), 'icon' => array('label' => __('Icon', 'Render'), 'type' => 'selectbox', 'properties' => array('callback' => array('function' => 'render_sc_icon_list'), 'allowIcons' => true, 'placeholder' => __('Select an icon (no icon by default)', 'Render'))), array('type' => 'section_break', 'label' => __('Link', 'Render')), 'link_type' => array('label' => __('Link Type', 'Render'), 'type' => 'selectbox', 'properties' => array('placeholder' => __('None', 'Render'), 'options' => array('link' => __('Link', 'Render'), 'email' => __('Email', 'Render'), 'phone' => __('Phone', 'Render')))), 'link_url' => render_sc_attr_template('link', array('required' => true, 'conditional' => array('visibility' => array('atts' => array('link_type' => array('type' => '==', 'value' => 'link')))))), 'link_email' => render_sc_attr_template('email', array('required' => true, 'conditional' => array('visibility' => array('atts' => array('link_type' => array('type' => '==', 'value' => 'email')))))), 'link_phone' => render_sc_attr_template('phone', array('required' => true, 'conditional' => array('visibility' => array('atts' => array('link_type' => array('type' => '==', 'value' => 'phone')))))), 'link_new_window' => array('label' => __('Link Window', 'Render'), 'type' => 'checkbox', 'properties' => array('label' => __('Open link in new tab', 'Render')), 'conditional' => array('visibility' => array('atts' => array('link_url' => array('type' => 'NOT EMPTY'))))), array('type' => 'section_break', 'description' => __('If all border-radius\' are set to 0, none will be used. If at least one is set, all will be used.', 'Render'), 'advanced' => true), 'border_top_left_radius' => render_sc_attr_template('border-radius', array(), array('orientation' => __('Top Left'))), 'border_top_right_radius' => render_sc_attr_template('border-radius', array(), array('orientation' => __('Top Right'))), 'border_bottom_left_radius' => render_sc_attr_template('border-radius', array(), array('orientation' => __('Bottom Left'))), 'border_bottom_right_radius' => render_sc_attr_template('border-radius', array(), array('orientation' => __('Bottom Right')))), 'wrapping' => true, 'render' => array('noStyle' => true)), array('code' => 'render_box', 'function' => '_render_sc_box', 'title' => __('Box', 'Render'), 'description' => __('Creates a nice box for your content.', 'Render'), 'atts' => array(array('type' => 'section_break', 'label' => __('Content', 'Render')), 'heading' => array('label' => __('Heading', 'Render')), array('type' => 'section_break', 'label' => __('Colors', 'Render')), 'color' => array('label' => __('Box Background', 'Render'), 'type' => 'colorpicker', 'default' => RENDER_PRIMARY_COLOR), 'font_color' => array('label' => __('Body Font', 'Render'), 'type' => 'colorpicker', 'default' => RENDER_PRIMARY_FONT_COLOR), 'heading_font_color' => array('label' => __('Heading Font', 'Render'), 'type' => 'colorpicker', 'default' => RENDER_PRIMARY_FONT_COLOR, 'conditional' => array('visibility' => array('atts' => array('heading' => array('type' => 'NOT EMPTY'))))), array('type' => 'section_break', 'label' => __('Visual', 'Render')), 'shape' => array('label' => __('Shape', 'Render'), 'type' => 'selectbox', 'properties' => array('placeholder' => __('Rectangle', 'Render'), 'options' => array('rectangle' => __('Rectangle', 'Render'), 'rounded' => __('Rounded', 'Render'), 'ellipse' => __('Ellipse', 'Render')))), 'heading_tag' => array('label' => __('Heading Tag', 'Render'), 'type' => 'selectbox', 'advanced' => true, 'properties' => array('allowCustomInput' => true, 'default' => 'h3', 'options' => array('h1' => 'Header 1', 'h2' => 'Header 2', 'h3' => 'Header 3', 'h4' => 'Header 4', 'h5' => 'Header 5', 'h6' => 'Header 6', 'p' => 'Paragraph', 'span' => 'Span', 'div' => 'DIV')), 'conditional' => array('visibility' => array('atts' => array('heading' => array('type' => 'NOT EMPTY'))))), array('type' => 'section_break', 'description' => __('If all border-radius\' are set to 0, none will be used. If at least one is set, all will be used. Note that this will override the "Shape" defined above.', 'Render'), 'advanced' => true), 'border_top_left_radius' => render_sc_attr_template('border-radius', array(), array('orientation' => __('Top Left'))), 'border_top_right_radius' => render_sc_attr_template('border-radius', array(), array('orientation' => __('Top Right'))), 'border_bottom_left_radius' => render_sc_attr_template('border-radius', array(), array('orientation' => __('Bottom Left'))), 'border_bottom_right_radius' => render_sc_attr_template('border-radius', array(), array('orientation' => __('Bottom Right')))), 'wrapping' => true, 'render' => array('noStyle' => true)), array('code' => 'render_columns_wrapper', 'function' => '_render_sc_columns_wrapper', 'title' => __('Columns', 'Render'), 'description' => __('Creates symmetrical columns for grouping content.', 'Render'), 'atts' => array('nested_children' => array('label' => __('Columns', 'Render'), 'description' => __('Maximum six columns', 'Render'), 'type' => 'repeater', 'properties' => array('max' => 6, 'fields' => array(array('label' => __('Column', 'Render'), 'type' => 'placeholder'))))), 'wrapping' => true, 'render' => array('nested' => array('child' => 'render_column_section'), 'displayBlock' => true)), array('code' => 'render_column_section', 'function' => '_render_sc_column_section', 'noDisplay' => true, 'wrapping' => true, 'render' => array('nested' => array('parent' => 'render_columns_wrapper'), 'dummyContent' => '(Enter column content here)')), array('code' => 'render_tabs_wrapper', 'function' => '_render_sc_tabs_wrapper', 'title' => __('Tabs', 'Render'), 'description' => __('Creates a tabbed layout for the content.', 'Render'), 'atts' => array('content_border' => array('label' => __('Tab Content Border', 'Render'), 'type' => 'toggle', 'properties' => array('deselectStyle' => true, 'flip' => true, 'values' => array('hide' => __('Hide', 'Render'), 'show' => __('Show', 'Render')))), array('label' => __('Colors', 'Render'), 'type' => 'section_break'), 'border_color' => array('label' => __('Borders', 'Render'), 'type' => 'colorpicker', 'default' => RENDER_PRIMARY_COLOR_DARK), 'navigation_tab_color' => array('label' => __('Navigation Tab', 'Render'), 'type' => 'colorpicker', 'default' => RENDER_PRIMARY_COLOR), 'navigation_tab_hover_color' => array('label' => __('Navigation Tab Hover', 'Render'), 'type' => 'colorpicker', 'default' => RENDER_PRIMARY_COLOR_LIGHT), 'navigation_tab_font_color' => array('label' => __('Navigation Tab Font', 'Render'), 'type' => 'colorpicker', 'default' => RENDER_PRIMARY_FONT_COLOR), array('label' => __('Tab Sections', 'Render'), 'type' => 'section_break'), 'nested_children' => array('label' => false, 'type' => 'repeater', 'properties' => array('fields' => array(array('label' => __('Tab Section', 'Render'), 'type' => 'placeholder'), 'navigation_label' => array('label' => __('Navigation Label', 'Render'), 'required' => true))))), 'wrapping' => true, 'render' => array('nested' => array('child' => 'render_tab_section', 'ignoreForChildren' => array('navigation_label')), 'displayBlock' => true, 'noStyle' => true)), array('code' => 'render_tab_section', 'function' => '_render_sc_tab_section', 'noDisplay' => true, 'wrapping' => true, 'render' => array('nested' => array('parent' => 'render_tabs_wrapper'), 'dummyContent' => '(Enter tab content here)', 'noStyle' => true, 'displayBlock' => true))) as $shortcode) {
    $shortcode['category'] = 'design';
    $shortcode['source'] = 'Render';
    render_add_shortcode($shortcode);
    render_add_shortcode_category(array('id' => 'design', 'label' => __('Design', 'Render'), 'icon' => 'dashicons-admin-appearance'));
}
/**
 * The main wrapper for an accordion.
 *
 * @since  1.1-beta-2
 * @access private
 *
 * @param array  $atts    The attributes sent to the shortcode.
 * @param string $content The content inside the shortcode.
 *
 * @return string The accordion wrapper HTML.
 */
function _render_sc_accordion_wrapper($atts = array(), $content = '')
{
    $atts = shortcode_atts(array('start_closed' => 'false'), $atts);
示例#2
0
 *
 * @since      1.0.0
 *
 * @package    Render
 * @subpackage Shortcodes
 */
// Exit if loaded directly
if (!defined('ABSPATH')) {
    die;
}
// Loops through each shortcode and adds it to Render
foreach (array(array('code' => 'render_date', 'function' => '_render_sc_custom_date', 'title' => __('Custom Date', 'Render'), 'description' => __('Outputs the current date in a custom format.', 'Render'), 'atts' => array('format' => render_sc_attr_template('full_date_format'), 'timezone' => render_sc_attr_template('timezone')), 'render' => true)) as $shortcode) {
    $shortcode['category'] = 'time';
    $shortcode['source'] = 'Render';
    render_add_shortcode($shortcode);
    render_add_shortcode_category(array('id' => 'time', 'label' => __('Time', 'Render'), 'icon' => 'dashicons-clock'));
}
/**
 * Gets the specified date format.
 *
 * @since  1.0.0
 * @access private
 *
 * @param array $atts The attributes sent to the shortcode.
 *
 * @return string The specified date format.
 */
function _render_sc_custom_date($atts)
{
    $atts = shortcode_atts(array('format' => 'default_date', 'timezone' => get_option('timezone_string', 'UTC')), $atts);
    // Escape atts
示例#3
0
 * Contains all Render packaged shortcodes within the Visibility category.
 *
 * @since      1.0.0
 * @package    Render
 * @subpackage Shortcodes
 */
// Exit if loaded directly
if (!defined('ABSPATH')) {
    die;
}
// Loops through each shortcode and adds it to Render
foreach (array(array('code' => 'render_logic', 'function' => '_render_sc_logic', 'title' => __('Logic', 'Render'), 'description' => __('Allows for the use of conditional statements for showing content.', 'Render'), 'atts' => array('arg1' => array('label' => __('Argument One', 'Render'), 'type' => 'selectbox', 'required' => true, 'properties' => array('options' => array('logged_in' => __('If user is logged in', 'Render'), 'home' => __('If current page is home page', 'Render'), 'comments' => __('If comments allowed', 'Render'), 'single' => __('If is single post', 'Render'), 'page' => __('If is page', 'Render'), 'category' => __('If is category page', 'Render'), 'tag' => __('If is tag page', 'Render'), 'tax' => __('If is taxonomy page', 'Render'), 'author' => __('If is archive of specific author', 'Render'), 'archive' => __('If current page is an archive page', 'Render'), 'search' => __('If current page is a search results page', 'Render'), '404' => __('If current page is a 404', 'Render'), 'wp_version' => __('If this site\'s WordPress install version', 'Render')))), 'operator' => array('label' => __('Operator', 'Render'), 'type' => 'selectbox', 'required' => true, 'default' => 'equals', 'properties' => array('options' => array('equals' => __('equals', 'Render'), 'identical' => __('is identical to', 'Render'), 'not_equal' => __('does not equal', 'Render'), 'not_identical' => __('is not identical to', 'Render'), 'less_than' => __('is less than', 'Render'), 'greater_than' => __('is greater than', 'Render'), 'less_than_or_equal' => __('is less than or equal to', 'Render'), 'greater_than_or_equal' => __('is greater than or equal to', 'Render')))), 'arg2' => array('label' => __('Argument Two', 'Render'), 'type' => 'selectbox', 'required' => true, 'default' => 'true', 'properties' => array('allowCustomInput' => true, 'options' => array('true' => __('true', 'Render'), 'false' => __('false', 'Render'))), 'conditional' => array('visibility' => array('atts' => array('arg1' => array('type' => 'NOT IN', 'value' => 'wp_version'))))), 'param' => array('label' => __('Parameter (optional)', 'Render'), 'description' => __('Used in some conditions to further specify the condition.', 'Render'), 'type' => 'selectbox', 'conditional' => array('visibility' => array('atts' => array('arg1' => array('type' => 'IN', 'value' => 'single,page,category,tag,tax,author'))), 'populate' => array('atts' => array('arg1'), 'callback' => '_render_sc_logic_param_populate'))), 'wp_version' => array('label' => __('Version', 'Render'), 'description' => __('Enter the version number in the format "#.#.#".', 'Render'), 'required' => true, 'conditional' => array('visibility' => array('atts' => array('arg1' => array('type' => '==', 'value' => 'wp_version')))))), 'render' => true, 'wrapping' => true), array('code' => 'render_hide_for_times', 'function' => '_render_sc_hide_for_times', 'title' => __('Hide for Times', 'Render'), 'description' => __('Allows content to be visible only during set times', 'Render'), 'atts' => array('visibility' => array('label' => __('Visibility', 'Render'), 'description' => __('Hide or show for the below times.', 'Render'), 'type' => 'toggle', 'properties' => array('values' => array('hide' => __('Hide', 'Render'), 'show' => __('Show', 'Render')))), 'times' => array('label' => __('Times', 'Render'), 'type' => 'repeater', 'properties' => array('startWith' => 1, 'fields' => array('time' => array('label' => __('Hide / show between...', 'Render'), 'type' => 'slider', 'callback' => 'render_sc_time_slider', 'initCallback' => 'timeSliderInit', 'properties' => array('range' => true))))), 'timezone' => render_sc_attr_template('timezone')), 'wrapping' => true, 'render' => true), array('code' => 'render_hide_for_users', 'function' => '_render_sc_hide_for_users', 'title' => __('Hide for Users', 'Render'), 'description' => __('Allows content to be visible only for specific users', 'Render'), 'atts' => array('visibility' => array('label' => __('Visibility', 'Render'), 'description' => __('Hide or show for below times.', 'Render'), 'type' => 'toggle', 'properties' => array('values' => array('hide' => __('Hide', 'Render'), 'show' => __('Show', 'Render')))), 'users' => array('label' => __('Users', 'Render'), 'type' => 'selectbox', 'properties' => array('placeholder' => __('Select one or more users', 'Render'), 'multi' => true, 'callback' => array('function' => 'render_sc_user_list')))), 'wrapping' => true, 'render' => true)) as $shortcode) {
    $shortcode['category'] = 'visibility';
    $shortcode['source'] = 'Render';
    render_add_shortcode($shortcode);
    render_add_shortcode_category(array('id' => 'visibility', 'label' => __('Visibility', 'Render'), 'icon' => 'dashicons-visibility'));
}
/**
 * Returns the content if the condition is met, otherwise, returns nothing.
 *
 * @since  1.0.0
 * @access private
 * @param array  $atts    The attributes sent to the shortcode.
 * @param string $content The content inside the shortcode.
 * @return bool True if statement succeeds, false otherwise. Doy!
 */
function _render_sc_logic($atts = array(), $content = '')
{
    $atts = shortcode_atts(array('arg1' => 'logged_in', 'arg2' => 'true', 'operator' => 'equals', 'param' => '', 'wp_version' => ''), $atts);
    // Escape atts
    render_esc_atts($atts);
示例#4
0
 *
 * @since      1.0.0
 *
 * @package    Render
 * @subpackage Shortcodes
 */
// Exit if loaded directly
if (!defined('ABSPATH')) {
    die;
}
// Loops through each shortcode and adds it to Render
foreach (array(array('code' => 'render_post_meta', 'function' => '_render_sc_post_meta', 'title' => __('Post Meta', 'Render'), 'description' => __('Displays the supplied meta information about the post.', 'Render'), 'tags' => 'id author title word count published date status type excerpt', 'atts' => array('post' => render_sc_attr_template('post_list'), 'meta' => array('label' => __('Meta', 'Render'), 'type' => 'selectbox', 'description' => __('The meta information of the post to show.', 'Render'), 'properties' => array('default' => 'title', 'placeholder' => __('Select which meta to get', 'Render'), 'allowCustomInput' => true, 'options' => array('title' => __('Title', 'Render'), 'author' => __('Author', 'Render'), 'status' => __('Status', 'Render'), 'type' => __('Type', 'Render'), 'excerpt' => __('Excerpt', 'Render'), 'content' => __('Content', 'Render'), 'published_date' => __('Published Date', 'Render'), 'word_count' => __('Word Count', 'Render'), 'id' => __('ID', 'Render')))), 'date_format' => render_sc_attr_template('date_format', array('conditional' => array('visibility' => array('atts' => array('meta' => array('type' => '==', 'value' => 'published_date'))))))), 'render' => true)) as $shortcode) {
    $shortcode['category'] = 'post';
    $shortcode['source'] = 'Render';
    render_add_shortcode($shortcode);
    render_add_shortcode_category(array('id' => 'post', 'label' => __('Post', 'Render'), 'icon' => 'dashicons-admin-post'));
}
/**
 * Gets the post ID.
 *
 * @since  0.3.0
 * @access private
 *
 * @param array $atts The attributes sent to the shortcode.
 *
 * @return int The post ID.
 */
function _render_sc_post_meta($atts = array())
{
    $atts = shortcode_atts(array('post' => get_the_ID(), 'meta' => 'title', 'date_format' => get_option('date_format', 'F j, Y')), $atts);
    if ($atts['date_format'] == 'default_date') {
示例#5
0
 *
 * @since      1.0.0
 *
 * @package    Render
 * @subpackage Shortcodes
 */
// Exit if loaded directly
if (!defined('ABSPATH')) {
    die;
}
// Loops through each shortcode and adds it to Render
foreach (array(array('code' => 'render_query', 'function' => '_render_query', 'title' => __('Query', 'Render'), 'description' => __('Outputs a list of posts.', 'Render'), 'tags' => 'data loop', 'atts' => array(array('type' => 'section_break', 'label' => __('Refine Search', 'Render')), 'author' => array('label' => __('Author', 'Render'), 'type' => 'selectbox', 'properties' => array('placeholder' => __('Any author', 'Render'), 'options' => render_sc_user_list('edit_posts'))), 'category' => array('label' => __('Category', 'Render'), 'type' => 'selectbox', 'properties' => array('no_options' => __('No categories available.', 'Render'), 'placeholder' => __('Any category', 'Render'), 'callback' => array('function' => 'render_categories_dropdown'))), 'tag' => array('label' => __('Tag', 'Render'), 'type' => 'selectbox', 'properties' => array('no_options' => __('No tags available.', 'Render'), 'placeholder' => __('-- None --', 'Render'), 'callback' => array('function' => 'render_tags_dropdown'))), 'post_type' => render_sc_attr_template('post_type_list', array()), 'include' => render_sc_attr_template('post_list', array('label' => __('Include', 'Render'), 'properties' => array('multi' => true, 'placeholder' => 'Select an option'), 'conditional' => array('populate' => array('atts' => array('post_type'), 'callback' => 'render_sc_populate_post_type')))), 'exclude' => render_sc_attr_template('post_list', array('label' => __('Exclude', 'Render'), 'properties' => array('multi' => true, 'placeholder' => 'Select an option'), 'conditional' => array('populate' => array('atts' => array('post_type'), 'callback' => 'render_sc_populate_post_type')))), 'numberposts' => array('label' => __('Count', 'Render'), 'description' => __('Max number of posts to show.', 'Render'), 'type' => 'counter', 'default' => 5, 'properties' => array('max' => 50)), array('type' => 'section_break', 'label' => __('Order', 'Render')), 'order' => render_sc_attr_template('post_order'), 'orderby' => render_sc_attr_template('post_orderby'), 'post_status' => array('label' => __('Post Status', 'Render'), 'type' => 'selectbox', 'properties' => array('placeholder' => __('Any status', 'Render'), 'callback' => array('function' => 'get_post_stati')), 'advanced' => true), 'offset' => array('label' => __('Offset', 'Render'), 'description' => __('Start at this many posts in from found posts.', 'Render'), 'type' => 'counter', 'default' => 0, 'properties' => array('max' => 60), 'advanced' => true), 's' => array('label' => __('Search', 'Render'), 'advanced' => true), 'meta_key' => array('label' => __('Meta Key', 'Render'), 'description' => __('The name of the meta key to use the value to search for.', 'Render'), 'advanced' => true), 'meta_value' => array('label' => __('Meta Key', 'Render'), 'description' => __('Only shows posts containing a meta key with this value.', 'Render'), 'advanced' => true, 'conditional' => array('visibility' => array('atts' => array('meta_key' => array('type' => 'NOT EMPTY'))))), 'suppress_filters' => array('label' => __('Suppress Filters', 'Render'), 'description' => __('Suppresses any filters applied to get_posts.', 'Render'), 'type' => 'checkbox', 'advanced' => true)), 'render' => true, 'wrapping' => false)) as $shortcode) {
    $shortcode['category'] = 'query';
    $shortcode['source'] = 'Render';
    render_add_shortcode($shortcode);
    render_add_shortcode_category(array('id' => 'query', 'label' => __('Query', 'Render'), 'icon' => 'dashicons-download'));
}
/**
 * Runs a WP_Query to provide a drop-down of posts.
 *
 * @since  0.3.0
 * @access private
 *
 * @param array $atts The attributes sent to the shortcode.
 *
 * @return string The drop-down HTML.
 */
function _render_query($atts = array())
{
    $atts = shortcode_atts(array('post_type' => 'any', 'author' => '', 'cat' => '', 'tag' => '', 's' => '', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_status' => '', 'order' => '', 'orderby' => '', 'suppress_filters' => '1'), $atts);
    // Escape atts
示例#6
0
 *
 * @since      1.0.0
 *
 * @package    Render
 * @subpackage Shortcodes
 */
// Exit if loaded directly
if (!defined('ABSPATH')) {
    die;
}
// Loops through each shortcode and adds it to Render
foreach (array(array('code' => 'render_user_info', 'function' => '_render_sc_user_info', 'title' => __('User Information', 'Render'), 'description' => __('Get a property of the specified user.', 'Render'), 'tags' => 'display name full first last user email id author url description role', 'atts' => array('user' => array('label' => __('User', 'Render'), 'type' => 'selectbox', 'properties' => array('placeholder' => __('Defaults to the current user', 'Render'), 'callback' => array('function' => 'render_sc_user_list'))), 'property' => array('label' => __('Property', 'Render'), 'description' => __('Select what information to get or input custom information to get.', 'Render'), 'required' => true, 'type' => 'selectbox', 'properties' => array('groups' => array(array('label' => __('Name', 'Render'), 'options' => array('display_name' => __('Display Name', 'Render'), 'full_name' => __('Full Name', 'Render'), 'first_name' => __('First Name', 'Render'), 'last_name' => __('Last Name', 'Render'), 'username' => __('User Name', 'Render'))), array('label' => __('Meta', 'Render'), 'options' => array('email' => __('Email Address', 'Render'), 'id' => __('ID', 'Render'), 'author_url' => __('Author Link', 'Render'), 'description' => __('Description', 'Render'), 'role' => __('Role', 'Render'), 'user_registered' => __('Registered Date', 'Render')))))), 'date_format' => render_sc_attr_template('date_format', array('conditional' => array('visibility' => array('atts' => array('property' => array('type' => '==', 'value' => 'user_registered'))))))), 'render' => true), array('code' => 'render_login_form', 'function' => '_render_sc_login_form', 'title' => __('Login form', 'Render'), 'description' => __('Displays a login form to logged out users.', 'Render'), 'atts' => array('message' => array('label' => __('Logged in Message', 'Render'), 'description' => __('Message to display to already logged in users.', 'Render'), 'properties' => array('placeholder' => __('You are already logged in.', 'Render'))), 'redirect' => array('label' => __('Redirect', 'Render'), 'description' => __('Redirect to this page after login.', 'Render'), 'type' => 'selectbox', 'properties' => array('groups' => array(), 'callback' => array('groups' => true, 'function' => 'render_sc_post_list'), 'placeholder' => __('Same page', 'Render'))), 'remember' => array('label' => __('Remember Me', 'Render'), 'type' => 'checkbox', 'properties' => array('value' => 'true', 'label' => __('Show "Remember Me" checkbox.', 'Render'))), array('type' => 'section_break', 'label' => __('Form Labels', 'Render'), 'advanced' => true), 'label_username' => array('label' => __('Username', 'Render'), 'advanced' => true, 'properties' => array('placeholder' => __('Username'))), 'label_password' => array('label' => __('Password', 'Render'), 'advanced' => true, 'properties' => array('placeholder' => __('Password'))), 'label_remember' => array('label' => __('Remember Me', 'Render'), 'advanced' => true, 'properties' => array('placeholder' => __('Remember Me'))), 'Label_log_in' => array('label' => __('Log In', 'Render'), 'advanced' => true, 'properties' => array('placeholder' => __('Log In'))), array('type' => 'section_break', 'label' => __('Default field values.', 'Render'), 'advanced' => true), 'value_username' => array('label' => __('Username', 'Render'), 'advanced' => true), 'value_remember' => array('label' => __('Remember Me', 'Render'), 'advanced' => true, 'type' => 'checkbox', 'properties' => array('label' => __('(start checked)', 'Render'), 'value' => 'true')), array('type' => 'section_break', 'label' => __('HTML ID\'s', 'Render'), 'advanced' => true), 'form_id' => array('label' => __('Form', 'Render'), 'advanced' => true, 'properties' => array('placeholder' => 'loginform')), 'id_username' => array('label' => __('Username', 'Render'), 'advanced' => true, 'properties' => array('placeholder' => 'user_login')), 'id_password' => array('label' => __('Password', 'Render'), 'advanced' => true, 'properties' => array('placeholder' => 'user_pass')), 'id_remember' => array('label' => __('Remember Me', 'Render'), 'advanced' => true, 'properties' => array('placeholder' => 'rememberme')), 'id_submit' => array('label' => __('Submit', 'Render'), 'advanced' => true, 'properties' => array('placeholder' => 'wp-submit'))), 'render' => true)) as $shortcode) {
    $shortcode['category'] = 'user';
    $shortcode['source'] = 'Render';
    render_add_shortcode($shortcode);
    render_add_shortcode_category(array('id' => 'user', 'label' => __('User', 'Render'), 'icon' => 'dashicons-admin-users'));
}
/**
 * Gets specified current user property.
 *
 * @since  1.0.0
 * @access private
 *
 * @param array $atts The attributes sent to the shortcode.
 *
 * @return string The specified current user property.
 */
function _render_sc_user_info($atts = array())
{
    $atts = shortcode_atts(array('user' => get_current_user_id(), 'property' => false, 'date_format' => get_option('date_format', 'F j, Y')), $atts);
    // Escape atts
示例#7
0
 *
 * @since      1.0.0
 *
 * @package    Render
 * @subpackage Shortcodes
 */
// Exit if loaded directly
if (!defined('ABSPATH')) {
    die;
}
// Loops through each shortcode and adds it to Render
foreach (array(array('code' => 'render_site_info', 'function' => '_render_sc_site_info', 'title' => __('Site Information', 'Render'), 'description' => __('Gets specified info about the current site.', 'Render'), 'tags' => 'title tag line admin email url version language description name', 'atts' => array('info' => array('label' => __('Info', 'Render'), 'description' => sprintf(__('Which information to get about the site. Either choose an option or input your own from this list: %s.', 'Render'), '<a href="http://codex.wordpress.org/Function_Reference/get_bloginfo">codex</a>'), 'type' => 'selectbox', 'properties' => array('allowCustomInput' => true, 'default' => 'title', 'options' => array('name' => __('Title', 'Render'), 'description' => __('Tag Line', 'Render'), 'admin_email' => __('Admin Email', 'Render'), 'url' => __('Site URL', 'Render'), 'version' => __('WordPress Version', 'Render'), 'language' => __('Language', 'Render'))))), 'render' => true)) as $shortcode) {
    $shortcode['category'] = 'site';
    $shortcode['source'] = 'Render';
    render_add_shortcode($shortcode);
    render_add_shortcode_category(array('id' => 'site', 'label' => __('Site', 'Render'), 'icon' => 'dashicons-admin-home'));
}
/**
 * Gets info about the current site.
 *
 * @since  1.0.0
 * @access private
 *
 * @param array $atts The attributes sent to the shortcode.
 *
 * @return string The desired blog info.
 */
function _render_sc_site_info($atts = array())
{
    $atts = shortcode_atts(array('info' => 'name'), $atts);
    // Escape atts
示例#8
0
 *
 * @package    Render
 * @subpackage Shortcodes
 */
// Exit if loaded directly
if (!defined('ABSPATH')) {
    die;
}
// Get some default values (mimicked how WP gets them)
$embed_width = isset($GLOBALS['content_width']) ? $GLOBALS['content_width'] : 500;
$embed_height = min(ceil($embed_width * 1.5), 1000);
foreach (array(array('code' => 'embed', 'title' => __('Embed', 'Render'), 'description' => __('It\'s super easy to embed videos, images, tweets, audio, and other content into your WordPress site', 'Render'), 'atts' => array('width' => array('label' => __('Width', 'Render'), 'type' => 'slider', 'properties' => array('value' => $embed_width, 'max' => $embed_width * 2)), 'height' => array('label' => __('Height', 'Render'), 'type' => 'slider', 'properties' => array('value' => $embed_height, 'max' => $embed_width * 2))), 'wrapping' => true), array('noDisplay' => true, 'code' => 'caption', 'title' => __('Caption', 'Render'), 'description' => __('The Caption feature allows you to wrap captions around content. This is primarily used with individual images.', 'Render'), 'atts' => array('caption' => array('label' => __('Caption', 'Render'), 'description' => __('If no ID is supplied, this will be used instead.', 'Render')), 'id' => array('label' => __('ID', 'Render'), 'description' => __('The ID of the image inside the caption from.', 'Render')), 'align' => array('label' => __('Align', 'Render'), 'type' => 'selectbox', 'properties' => array('options' => array('alignnone' => __('None', 'Render'), 'aligncenter' => __('Center', 'Render'), 'alignright' => __('Right', 'Render'), 'alignleft' => __('Left', 'Render')))), 'width' => array('label' => __('Width', 'Render'), 'advanced' => true), 'class' => array('label' => __('Class', 'Render'), 'description' => __('CSS class to add.', 'Render'), 'advanced' => true)), 'wrapping' => true, 'render' => array('ignore' => true)), array('code' => 'gallery', 'title' => __('Gallery', 'Render'), 'description' => __('The Gallery feature allows you to add one or more image galleries to your posts and pages', 'Render'), 'atts' => array('ids' => array('label' => __('IDs', 'Render'), 'description' => __('Comma delimited list of attachment IDs to use', 'Render'), 'required' => true), 'orderby' => array('label' => __('Order By', 'Render'), 'type' => 'selectbox', 'properties' => array('default' => 'post_date', 'options' => array('menu_order' => __('Menu Order', 'Render'), 'title' => __('Title', 'Render'), 'post_date' => __('Post Date', 'Render'), 'rand' => __('Random', 'Render'), 'ID' => __('ID', 'Render')))), 'order' => array('label' => __('Order', 'Render'), 'type' => 'toggle', 'properties' => array('values' => array('DSC' => __('Descending', 'Render'), 'ASC' => __('Ascending', 'Render')))), 'columns' => array('label' => __('Columns', 'Render'), 'type' => 'slider', 'properties' => array('value' => 4, 'min' => 1, 'max' => 8)), 'size' => array('label' => __('Size', 'Render'), 'description' => __('Image size to use.', 'Render'), 'type' => 'selectbox', 'properties' => array('default' => 'full', 'callback' => array('function' => 'render_image_sizes_dropdown'))), 'include' => array('label' => __('Include', 'Render'), 'advanced' => true), 'exclude' => array('label' => __('Exclude', 'Render'), 'advanced' => true), 'itemtag' => array('label' => __('Item Tag', 'Render'), 'advanced' => true), 'icontag' => array('label' => __('Icon Tag', 'Render'), 'advanced' => true), 'captiontag' => array('label' => __('Caption Tag', 'Render'), 'advanced' => true), 'link' => array('label' => __('Link', 'Render'), 'advanced' => true))), array('code' => 'playlist', 'title' => __('Playlist', 'Render'), 'description' => __('The playlist shortcode implements the functionality of displaying a collection of WordPress audio or video files in a post', 'Render'), 'atts' => array('ids' => array('label' => __('IDs', 'Render'), 'description' => __('Comma delimited list of attachment IDs to use', 'Render'), 'required' => true), 'type' => array('label' => __('Type', 'Render'), 'type' => 'toggle', 'properties' => array('values' => array('audio' => __('Audio', 'Render'), 'video' => __('Video', 'Render')))), 'orderby' => array('label' => __('Order By', 'Render'), 'type' => 'selectbox', 'properties' => array('default' => 'post_date', 'options' => array('menu_order' => __('Menu Order', 'Render'), 'title' => __('Title', 'Render'), 'post_date' => __('Post Date', 'Render'), 'rand' => __('Random', 'Render'), 'ID' => __('ID', 'Render')))), 'order' => array('label' => __('Order', 'Render'), 'type' => 'toggle', 'properties' => array('values' => array('DSC' => __('Descending', 'Render'), 'ASC' => __('Ascending', 'Render')))), 'style' => array('label' => __('Style', 'Render'), 'type' => 'toggle', 'properties' => array('values' => array('light' => __('Light', 'Render'), 'dark' => __('Dark', 'Render')))), 'include' => array('label' => __('Include', 'Render'), 'advanced' => true), 'exclude' => array('label' => __('Exclude', 'Render'), 'advanced' => true), 'tracklist' => array('label' => __('Track List', 'Render'), 'type' => 'toggle', 'properties' => array('values' => array('false' => __('False', 'Render'), 'true' => __('True', 'Render'))), 'advanced' => true), 'tracknumbers' => array('label' => __('Track Numbers', 'Render'), 'type' => 'toggle', 'properties' => array('values' => array('false' => __('False', 'Render'), 'true' => __('True', 'Render'))), 'advanced' => true), 'images' => array('label' => __('Images', 'Render'), 'type' => 'toggle', 'properties' => array('values' => array('false' => __('False', 'Render'), 'true' => __('True', 'Render'))), 'advanced' => true), 'artists' => array('label' => __('Artists', 'Render'), 'type' => 'toggle', 'properties' => array('values' => array('false' => __('False', 'Render'), 'true' => __('True', 'Render'))), 'advanced' => true))), array('code' => 'audio', 'title' => __('Audio', 'Render'), 'description' => __('The Audio feature allows you to embed audio files and play them back', 'Render'), 'atts' => array('src' => array('label' => __('Source', 'Render'), 'type' => 'media', 'properties' => array('type' => 'audio'), 'required' => true), 'loop' => array('label' => __('Loop', 'Render'), 'type' => 'toggle', 'properties' => array('values' => array('off' => __('Off', 'Render'), 'on' => __('On', 'Render'))), 'advanced' => true), 'autoplay' => array('label' => __('Autoplay', 'Render'), 'type' => 'toggle', 'properties' => array('values' => array('off' => __('Off', 'Render'), 'on' => __('On', 'Render'))), 'advanced' => true), 'preload' => array('label' => __('Pre Load', 'Render'), 'type' => 'selectbox', 'properties' => array('options' => array('metadata' => __('Metadata', 'Render'), 'none' => __('None', 'Render'), 'auto' => __('Auto', 'Render'))), 'advanced' => true))), array('code' => 'video', 'title' => __('Video', 'Render'), 'description' => __('The Video feature allows you to embed video files and play them back', 'Render'), 'atts' => array('src' => array('label' => __('Source', 'Render'), 'type' => 'media', 'properties' => array('type' => 'video'), 'required' => true), 'width' => array('label' => __('Width', 'Render'), 'type' => 'slider', 'properties' => array('value' => 640, 'min' => 1, 'max' => 2000)), 'height' => array('label' => __('Height', 'Render'), 'type' => 'slider', 'properties' => array('value' => 360, 'min' => 1, 'max' => 2000)), 'loop' => array('label' => __('Loop', 'Render'), 'type' => 'toggle', 'properties' => array('values' => array('off' => __('Off', 'Render'), 'on' => __('On', 'Render'))), 'advanced' => true), 'autoplay' => array('label' => __('Auto Play', 'Render'), 'type' => 'toggle', 'properties' => array('values' => array('off' => __('Off', 'Render'), 'on' => __('On', 'Render'))), 'advanced' => true), 'preload' => array('label' => __('Pre Load', 'Render'), 'type' => 'selectbox', 'properties' => array('options' => array('metadata' => __('Metadata', 'Render'), 'none' => __('None', 'Render'), 'auto' => __('Auto', 'Render'))), 'advanced' => true), 'poster' => array('label' => __('Poster', 'Render'), 'type' => 'media', 'advanced' => true)))) as $shortcode) {
    $shortcode['category'] = 'media';
    $shortcode['source'] = 'WordPress';
    render_add_shortcode($shortcode);
    render_add_shortcode_category(array('id' => 'media', 'label' => __('Media', 'Render'), 'icon' => 'dashicons-admin-media'));
}
// Remove wp_caption from Render shortcodes (is duplicate of caption)
add_filter('render_add_shortcodes', function ($shortcodes) {
    unset($shortcodes['wp_caption']);
    return $shortcodes;
}, 999);
/**
 * Provides a Render selectbox with options for all registered image sizes.
 *
 * @since 1.0.0
 *
 * @return array All WP image sizes.
 */
function render_image_sizes_dropdown()
{