function cws_mb_page_callback($post) { $cws_stored_meta = get_post_meta($post->ID, 'cws-mb'); $sb_layout = isset($cws_stored_meta[0]['cws-mb-sb_layout']) ? esc_attr($cws_stored_meta[0]['cws-mb-sb_layout']) : 'default'; $blogtype_selected = $sb_layout == 'default' ? 'medium' : (isset($cws_stored_meta[0]['cws-mb-blogtype']) ? esc_attr($cws_stored_meta[0]['cws-mb-blogtype']) : 'small'); $sb_override = isset($cws_stored_meta[0]['cws-mb-sb_override']); $sidebar1 = isset($cws_stored_meta[0]['cws-mb-sidebar1']) ? esc_attr($cws_stored_meta[0]['cws-mb-sidebar1']) : ''; $sidebar2 = isset($cws_stored_meta[0]['cws-mb-sidebar2']) ? esc_attr($cws_stored_meta[0]['cws-mb-sidebar2']) : ''; $category = isset($cws_stored_meta[0]['cws-mb-category']) ? $cws_stored_meta[0]['cws-mb-category'] : ''; $sb_is_blog = isset($cws_stored_meta[0]['cws-mb-is_blog']); $sb_foot_override = isset($cws_stored_meta[0]['cws-mb-sb_foot_override']); $footer_sidebar_top = isset($cws_stored_meta[0]['cws-mb-footer-sidebar-top']) ? esc_attr($cws_stored_meta[0]['cws-mb-footer-sidebar-top']) : ''; $footer_sidebar_bottom = isset($cws_stored_meta[0]['cws-mb-footer-sidebar-bottom']) ? esc_attr($cws_stored_meta[0]['cws-mb-footer-sidebar-bottom']) : ''; $slider = isset($cws_stored_meta[0]['cws-mb-slider']) ? esc_attr($cws_stored_meta[0]['cws-mb-slider']) : ''; $sb_slider_override = isset($cws_stored_meta[0]['cws-mb-sb_slider_override']); $pinterest_layout = isset($cws_stored_meta[0]["cws-mb-pinterest_layout"]) ? $cws_stored_meta[0]["cws-mb-pinterest_layout"] : ''; $pinterest_layout_override = $blogtype_selected == 'pinterest' ? true : false; wp_nonce_field('cws_mb_nonce', 'mb_nonce'); $redux_img = get_template_directory_uri() . '/framework/rc/assets/img/'; $showhide = $sb_layout == 'left' || $sb_layout == 'right' || $sb_layout == 'both' ? 'show' : 'hide'; $post_mbhtml_attr = array('page-meta' => array('options' => array(array('id' => 'sb_layout', 'title' => __('Sidebar Position', THEME_SLUG), 'type' => 'image_select', 'options' => array('default' => array('title' => __('Default', THEME_SLUG), 'img' => $redux_img . 'default.png', 'hide' => array('sidebar1', 'sidebar2')), 'left' => array('title' => __('Left', THEME_SLUG), 'img' => $redux_img . 'left.png', 'show' => array('sidebar1'), 'hide' => array('sidebar2')), 'right' => array('title' => __('Right', THEME_SLUG), 'img' => $redux_img . 'right.png', 'show' => array('sidebar1'), 'hide' => array('sidebar2')), 'both' => array('title' => __('Double', THEME_SLUG), 'img' => $redux_img . 'both.png', 'show' => array('sidebar1', 'sidebar2')), 'none' => array('title' => __('None', THEME_SLUG), 'img' => $redux_img . 'none.png', 'hide' => array('sidebar1', 'sidebar2'))), 'default' => $sb_layout, 'w' => '100%'), array('id' => 'sidebar1', 'hidden' => $sb_layout != 'left' && $sb_layout != 'right' && $sb_layout != 'both', 'title' => __('Select a sidebar', THEME_SLUG), 'type' => 'select', 'source' => 'sidebars', 'default' => $sidebar1, 'w' => '50%'), array('id' => 'sidebar2', 'hidden' => $sb_layout != 'both', 'title' => __('Select right sidebar', THEME_SLUG), 'type' => 'select', 'source' => 'sidebars', 'default' => $sidebar2, 'w' => '50%'), array('id' => 'sb_override', 'type' => 'check', 'title' => __('This page is a Blog List:', THEME_SLUG), 'hide' => array('blogtype', 'category[]', 'pinterest_layout'), 'source' => array('' => ''), 'default' => array($sb_override)), array('id' => 'blogtype', 'hidden' => !$sb_override || $sb_layout == 'default', 'type' => 'image_select', 'title' => __('Blog Layout', THEME_SLUG), 'options' => array('small' => array('title' => __('Small', THEME_SLUG), 'img' => $redux_img . 'small.png', 'hide' => array('pinterest_layout')), 'medium' => array('title' => __('Medium', THEME_SLUG), 'img' => $redux_img . 'medium.png', 'hide' => array('pinterest_layout')), 'large' => array('title' => __('Large', THEME_SLUG), 'img' => $redux_img . 'large.png', 'hide' => array('pinterest_layout')), 'pinterest' => array('title' => __('Pinterest', THEME_SLUG), 'img' => $redux_img . 'pinterest.png', 'show' => array('pinterest_layout'))), 'default' => $blogtype_selected, 'w' => '250px'), array('id' => 'pinterest_layout', 'title' => __('Columns', THEME_SLUG), 'hidden' => !$sb_override || $blogtype_selected != 'pinterest' || $sb_layout == 'default', 'type' => 'image_select', 'options' => array('2' => array('title' => __('Two', THEME_SLUG), 'img' => $redux_img . 'pinterest_2_columns.png'), '3' => array('title' => __('Three', THEME_SLUG), 'img' => $redux_img . 'pinterest_3_columns.png'), '4' => array('title' => __('Four', THEME_SLUG), 'img' => $redux_img . 'pinterest_4_columns.png')), 'default' => $pinterest_layout ? $pinterest_layout : '2', 'w' => '250px'), array('id' => 'category', 'hidden' => !$sb_override, 'title' => __('Category', THEME_SLUG), 'desc' => __('Blog categories', THEME_SLUG), 'type' => 'select', 'select' => 'multiple', 'source' => 'categories', 'default' => $category, 'w' => '100%'), array('id' => '', 'title' => __('Customize footer for this page:', THEME_SLUG), 'type' => 'group', 'source' => array(array('id' => 'sb_foot_override', 'type' => 'check', 'hide' => array('footer-sidebar-top', 'footer-sidebar-bottom'), 'source' => array('' => ''), 'default' => array($sb_foot_override)), array('id' => 'footer-sidebar-top', 'hidden' => !$sb_foot_override, 'title' => __('Select Footer sidebar', THEME_SLUG), 'type' => 'select', 'source' => 'sidebars', 'default' => $footer_sidebar_top, 'w' => '250px'), array('id' => 'footer-sidebar-bottom', 'hidden' => !$sb_foot_override, 'title' => __('Select Copyrights sidebar', THEME_SLUG), 'type' => 'select', 'source' => 'sidebars', 'default' => $footer_sidebar_bottom, 'w' => '250px')), 'w' => '100%'), array('id' => '', 'title' => __('Show Slider on this page:', THEME_SLUG), 'type' => 'group', 'source' => array(array('id' => 'sb_slider_override', 'type' => 'check', 'hide' => array('slider'), 'source' => array('' => ''), 'default' => array($sb_slider_override)), array('id' => 'slider', 'hidden' => !$sb_slider_override, 'desc' => 'Slider shortcode', 'type' => 'text', 'default' => $slider, 'w' => '90%')), 'w' => '100%')))); ?> <section class="cws-page-section"> <?php echo cws_shortcode_html_gen($post_mbhtml_attr, 'page-meta', 0, '', false); ?> </section> <?php }
function cws_mb_post_callback($post) { $cws_stored_meta = get_post_meta($post->ID, 'cws-mb'); $gallery = isset($cws_stored_meta[0]['cws-mb-gallery']) ? esc_attr($cws_stored_meta[0]['cws-mb-gallery']) : ''; $video = isset($cws_stored_meta[0]['cws-mb-video']) ? esc_attr($cws_stored_meta[0]['cws-mb-video']) : ''; $audio = isset($cws_stored_meta[0]['cws-mb-audio']) ? esc_attr($cws_stored_meta[0]['cws-mb-audio']) : ''; $link = isset($cws_stored_meta[0]['cws-mb-link']) ? esc_attr($cws_stored_meta[0]['cws-mb-link']) : ''; $quote = isset($cws_stored_meta[0]['cws-mb-quote']) ? esc_attr($cws_stored_meta[0]['cws-mb-quote']) : ''; $quote_author = isset($cws_stored_meta[0]['cws-mb-quote-author']) ? esc_attr($cws_stored_meta[0]['cws-mb-quote-author']) : ''; $table_currency = isset($cws_stored_meta[0]['cws-mb-table-currency']) ? esc_attr($cws_stored_meta[0]['cws-mb-table-currency']) : ''; $table_price = isset($cws_stored_meta[0]['cws-mb-table-price']) ? esc_attr($cws_stored_meta[0]['cws-mb-table-price']) : ''; $table_price_description = isset($cws_stored_meta[0]['cws-mb-table-price-description']) ? esc_attr($cws_stored_meta[0]['cws-mb-table-price-description']) : ''; $table_encourage = isset($cws_stored_meta[0]['cws-mb-table-encourage']) ? esc_attr($cws_stored_meta[0]['cws-mb-table-encourage']) : ''; $table_order = isset($cws_stored_meta[0]['cws-mb-table-order']) ? esc_attr($cws_stored_meta[0]['cws-mb-table-order']) : ''; $table_signup = isset($cws_stored_meta[0]['cws-mb-table-signup']) ? esc_attr($cws_stored_meta[0]['cws-mb-table-signup']) : 'Sign up!'; $table_hilighted = isset($cws_stored_meta[0]['cws-mb-table-hilighted']) ? true : false; wp_nonce_field('cws_mb_nonce', 'mb_nonce'); $post_mbhtml_attr = array('gallery' => array('options' => array(array('id' => 'gallery', 'title' => __('Gallery', THEME_SLUG), 'type' => 'text', 'default' => $gallery, 'w' => '50%'), array('id' => 'media-button', 'title' => '', 'desc' => '', 'value' => __('Add images', THEME_SLUG), 'type' => 'button', 'w' => '20%'))), 'video' => array('options' => array(array('id' => 'video', 'title' => __('URL to video file', THEME_SLUG), 'desc' => __('Ex.: http://player.vimeo.com/video/44510157?color=ffffff', THEME_SLUG), 'type' => 'textarea', 'rows' => '3', 'default' => $video, 'w' => '100%'))), 'quote' => array('options' => array(array('id' => 'quote', 'title' => __('Quote', THEME_SLUG), 'desc' => __('Enter the quote', THEME_SLUG), 'type' => 'textarea', 'rows' => '6', 'default' => $quote, 'w' => '100%'), array('id' => 'quote-author', 'title' => __('Author', THEME_SLUG), 'type' => 'text', 'default' => $quote_author, 'w' => '50%'))), 'audio' => array('options' => array(array('id' => 'audio', 'title' => __('URL to audio file', THEME_SLUG), 'desc' => __('Ex.: /wp-content/uploads/audio.mp3', THEME_SLUG), 'type' => 'text', 'default' => $audio, 'w' => '100%'))), 'link' => array('options' => array(array('id' => 'link', 'title' => __('URL', THEME_SLUG), 'type' => 'text', 'default' => $link, 'w' => '100%'))), 'table-price' => array('options' => array(array('id' => 'table-currency', 'title' => __('Currency', THEME_SLUG), 'type' => 'text', 'default' => $table_currency, 'w' => '100%'), array('id' => 'table-price', 'title' => __('Price', THEME_SLUG), 'type' => 'text', 'default' => $table_price, 'w' => '100%'), array('id' => 'table-price-description', 'title' => __('Price Description', THEME_SLUG), 'type' => 'text', 'default' => $table_price_description, 'w' => '100%'), array('id' => 'table-encourage', 'title' => __('Encouragement', THEME_SLUG), 'desc' => __('Encourage your customers with some simple words', THEME_SLUG), 'type' => 'text', 'default' => $table_encourage, 'w' => '100%'), array('id' => 'table-order', 'title' => __('Order url', THEME_SLUG), 'type' => 'text', 'default' => $table_order, 'w' => '100%'), array('id' => 'table-signup', 'title' => __('Button name', THEME_SLUG), 'type' => 'text', 'default' => $table_signup, 'w' => '100%'), array('id' => 'table-hilighted', 'title' => __('Highlight this cell', THEME_SLUG), 'type' => 'check', 'source' => array('' => ''), 'default' => array($table_hilighted))))); ?> <section id="post-gallery" class="cws-post-section"> <?php echo cws_shortcode_html_gen($post_mbhtml_attr, 'gallery', 0, '', false); ?> </section> <section id="post-video" class="cws-post-section"> <?php echo cws_shortcode_html_gen($post_mbhtml_attr, 'video', 0, '', false); ?> </section> <section id="post-quote" class="cws-post-section"> <?php echo cws_shortcode_html_gen($post_mbhtml_attr, 'quote', 0, '', false); ?> </section> <section id="post-audio" class="cws-post-section"> <?php echo cws_shortcode_html_gen($post_mbhtml_attr, 'audio', 0, '', false); ?> </section> <section id="post-link" class="cws-post-section"> <?php echo cws_shortcode_html_gen($post_mbhtml_attr, 'link', 0, '', false); ?> </section> <section id="post-table" class="cws-post-section"> <?php echo cws_shortcode_html_gen($post_mbhtml_attr, 'table-price', 0, '', false); ?> </section> <?php }
function cws_mb_portfolio_callback($post) { $cws_stored_meta = get_post_meta($post->ID, 'cws-portfolio'); $short_desc = isset($cws_stored_meta[0]['cws-portfolio-short_desc']) ? esc_attr($cws_stored_meta[0]['cws-portfolio-short_desc']) : ''; $video = isset($cws_stored_meta[0]['cws-portfolio-video']) ? esc_attr($cws_stored_meta[0]['cws-portfolio-video']) : ''; $is_video_link = isset($cws_stored_meta[0]['cws-portfolio-is-video-link']) ? true : false; $use_rel_projects = isset($cws_stored_meta[0]['cws-portfolio-use_rel_projects']) ? true : false; $rel_projects_title = isset($cws_stored_meta[0]['cws-portfolio-rel_projects_title']) ? $cws_stored_meta[0]['cws-portfolio-rel_projects_title'] : ''; $rel_projects_num = isset($cws_stored_meta[0]['cws-portfolio-rel_projects_num']) ? $cws_stored_meta[0]['cws-portfolio-rel_projects_num'] : '4'; wp_nonce_field('cws_mb_nonce', 'mb_nonce'); $post_mbhtml_attr = array('portfolio' => array('options' => array(array('id' => 'short_desc', 'title' => __('Excerpt', THEME_SLUG), 'type' => 'text', 'default' => $short_desc, 'w' => '50%'), array('id' => 'video', 'title' => __('Custom URL', THEME_SLUG), 'type' => 'textarea', 'rows' => '3', 'default' => $video, 'w' => '50%'), array('id' => 'is-video-link', 'title' => __('Use direct URL instead of the popup', THEME_SLUG), 'type' => 'check', 'source' => array('' => ''), 'default' => array($is_video_link)), array('id' => '', 'title' => __('Show related projects:', THEME_SLUG), 'type' => 'group', 'source' => array(array('id' => 'use_rel_projects', 'type' => 'check', 'toggle' => array('rel_projects_title', 'rel_projects_num'), 'source' => array('' => ''), 'default' => array($use_rel_projects)), array('id' => 'rel_projects_title', 'disabled' => !$use_rel_projects, 'title' => __('Carousel title', THEME_SLUG), 'type' => 'text', 'default' => $rel_projects_title, 'w' => '300px'), array('id' => 'rel_projects_num', 'disabled' => !$use_rel_projects, 'title' => __('Number of items', THEME_SLUG), 'type' => 'text', 'default' => $rel_projects_num, 'w' => '200px')))))); ?> <section id="cws-portfolio-section" class="cws-portfolio-section"> <?php echo cws_shortcode_html_gen($post_mbhtml_attr, 'portfolio', 0, false, false, 'portfolio'); ?> </section> <?php }
<div class="cws-shortcode-container" id="cws-shortcode-container"> <input type="hidden" name="cws-shortcode-type" id="cws-shortcode-type" value="<?php echo $shortcode; ?> "> <input type="hidden" name="cws-shortcode-selection" id="cws-shortcode-selection" value="<?php echo esc_attr($selection); ?> "> <input type="hidden" name="cws-theme-color" id="cws-theme-color" value="<?php echo $theme_color; ?> "> <?php echo '<section id="cws-' . $shortcode . '" class="cws-shortcode-section">'; ?> <?php echo cws_shortcode_html_gen($cws_shortcode_attr, $shortcode, $selection, '', true); ?> </section> <br/> <input type="submit" class="button button-primary button-large" id="cws_insert_button" value="<?php _e('Insert Shortcode', 'happykids'); ?> "> </div> <script>cws_shortcode_init();</script> </body> </html>