function rt_generate_blog_box($theGroupID, $theTemplateID, $options, $randomClass) { $boxName = __("Blog Posts", "rt_theme_admin"); $contet_type = "blog_box"; $theTemplateID = str_replace('_' . $contet_type, '', $theTemplateID); $isNewBox = trim($randomClass) == "" ? false : true; $opacity = 1; $layout = "one passive_module"; $position = $isNewBox ? 'open minus' : 'plus'; $data_position = 'display: none;'; $categories = $isNewBox ? '' : $options['categories']; $pagination = $isNewBox ? '' : $options['pagination']; $list_orderby = $isNewBox ? '' : $options['list_orderby']; $list_order = $isNewBox ? '' : $options['list_order']; $item_per_page = $isNewBox ? '' : $options['item_per_page']; $list_layout = isset($options["list_layout"]) ? $options["list_layout"] : ""; $list_style = isset($options["list_style"]) ? $options["list_style"] : ""; echo '<li class="ui-state-default ' . $layout . '" style="opacity:' . $opacity . ';">'; echo '<div class="box_shadow"><div class="Itemholder"><div class="Itemheader"><h5>' . $boxName . '</h5>'; echo $this->module_controls($isNewBox); echo '</div><div class="ItemData" style="' . $data_position . '">'; echo '<input type="hidden" name="theTemplateID_' . $theGroupID . '" value="' . $theTemplateID . '"><input type="hidden" name="theGroupID_' . $theGroupID . '" value="' . $theGroupID . '"><input type="hidden" name="source_type_' . $theGroupID . '" value="' . $contet_type . '">'; $options = array(array("desc" => __("This module displays a bloglist following the settings below.", 'rt_theme_admin'), "hr" => "true", "type" => "info"), array("value" => "one", "id" => $theTemplateID . '_' . $theGroupID . "_blog_box[layout]", "type" => "hidden"), array("type" => "table_start"), array("name" => __("Select Post Categories", 'rt_theme_admin'), "desc" => __("Select and set categories to filter (shorten) the amount of posts presented in the bloglist. If you don't select and set a category, this module will list all blogposts.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_blog_box[categories][]", "options" => RTTheme::rt_get_categories(), "purpose" => "sidebar", "type" => "selectmultiple", "class" => $randomClass, "default" => $categories), array("name" => __("Listing Style", 'rt_theme_admin'), "desc" => __('Select and set one of the three available styles for listing the blog posts.', 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_blog_box[list_style]", "options" => array('style1' => 'Style One ( Big Date Boxes )', 'style2' => 'Style Two ( Post Type Icons )', 'style3' => 'Style Three ( Classic ) '), "value" => $list_style, "default" => "style1", "dont_save" => true, "type" => "select"), array("name" => __("Listing Layout", 'rt_theme_admin'), "desc" => __('Select and set the column layout for listing the blog posts. (<strong>Note</strong> : when used in a column module which is f.e. set to a 1/5 column it is better to set the blog column layout to a 1/1 layout.)', 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_blog_box[list_layout]", "options" => array('one' => 'One Column', 'two' => 'Two Columns', 'three' => 'Three Columns', 'four' => 'Four Columns', 'five' => 'Five Columns'), "value" => $list_layout, "default" => "one", "dont_save" => true, "type" => "select"), array("type" => "td_col"), array("name" => __("OrderBy Parameter", 'rt_theme_admin'), "desc" => __("Select and set the sorting order for the blog posts within the bloglist by this parameter.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_blog_box[list_orderby]", "options" => array('author' => 'Author', 'date' => 'Date', 'title' => 'Title', 'modified' => 'Modified', 'ID' => 'ID', 'rand' => 'Randomized'), "value" => $list_orderby, "default" => "date", "dont_save" => true, "type" => "select"), array("name" => __("Order", 'rt_theme_admin'), "desc" => __("Select and set the ascending or descending order for the ORDERBY parameter", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_blog_box[list_order]", "options" => array('ASC' => 'Ascending', 'DESC' => 'Descending'), "value" => $list_order, "default" => "DESC", "dont_save" => true, "type" => "select"), array("name" => __("Amount of blog post per page", 'rt_theme_admin'), "desc" => __("Set the amount of posts to display at once per page.<br /><strong>Note</strong> : works in conjunction with the pagination settings.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_blog_box[item_per_page]", "min" => "1", "max" => "200", "class" => $randomClass, "value" => $item_per_page, "default" => "9", "dont_save" => true, "type" => "rangeinput"), array("name" => __("Pagination", 'rt_theme_admin'), "check_desc" => __("Enable (if checked) the pagination ability for the bloglist.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_blog_box[pagination]", "type" => "checkbox", "class" => $randomClass, "value" => $pagination, "default" => "off", "std" => "false"), array("type" => "table_end")); echo $this->rt_generate_forms($options); echo '</div></div></div></li>'; }
function rt_generate_blog_carousel($theGroupID, $theTemplateID, $options, $randomClass) { $boxName = __("Blog Carousel", "rt_theme_admin"); $contet_type = "blog_carousel"; $theTemplateID = str_replace('_' . $contet_type, '', $theTemplateID); $isNewBox = trim($randomClass) == "" ? false : true; $opacity = 1; $layout = "one passive_module"; $position = $isNewBox ? 'open minus' : 'plus'; $data_position = 'display: none;'; $categories = isset($options['categories']) ? $options['categories'] : array(); $values = isset($options['values']) ? $options['values'] : array(); $heading = $heading_icon = $list_order = $list_orderby = $item_width = $max_item = $crop = $display_excerpts = $limit_chars = $style = ""; extract($values); echo '<li class="ui-state-default ' . $layout . '" style="opacity:' . $opacity . ';">'; echo '<div class="box_shadow"><div class="Itemholder"><div class="Itemheader"><h5>' . $boxName . '</h5>'; echo $this->module_controls($isNewBox); echo '</div><div class="ItemData" style="' . $data_position . '">'; echo '<input type="hidden" name="theTemplateID_' . $theGroupID . '" value="' . $theTemplateID . '"><input type="hidden" name="theGroupID_' . $theGroupID . '" value="' . $theGroupID . '"><input type="hidden" name="source_type_' . $theGroupID . '" value="' . $contet_type . '">'; $options = array(array("desc" => __("This module displays blog posts as a carousel following the settings below.", 'rt_theme_admin'), "hr" => "true", "type" => "info"), array("type" => "table_start"), array("name" => __("Heading", 'rt_theme_admin'), "desc" => __('Enter a title to be displayed above the blog posts carousel.', 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_blog_carousel[values][heading]", "value" => $heading, "type" => "text"), array("name" => __("Heading Icon", 'rt_theme_admin'), "desc" => __('Select and set a icon to precede the blog posts carousel title.', 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_blog_carousel[values][heading_icon]", "class" => "icon_selection", "value" => $heading_icon, "type" => "text"), array("name" => __("Select Categories", 'rt_theme_admin'), "desc" => __("Select and set categories to filter (shorten) the amount of blog posts presented in the carousel. If you don't select and set a category, this module will list all blogposts.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_blog_carousel[values][categories][]", "options" => RTTheme::rt_get_categories(), "purpose" => "sidebar", "type" => "selectmultiple", "class" => $randomClass, "default" => $categories), array("name" => __("OrderBy Parameter", 'rt_theme_admin'), "desc" => __("Select and set the sorting order for the blog posts within the carousel by this parameter.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_blog_carousel[values][list_orderby]", "options" => array('author' => 'Author', 'date' => 'Date', 'title' => 'Title', 'modified' => 'Modified', 'ID' => 'ID', 'rand' => 'Randomized'), "value" => $list_orderby, "default" => "date", "dont_save" => true, "type" => "select"), array("name" => __("Order", 'rt_theme_admin'), "desc" => __("Select and set the ascending or descending order for the ORDERBY parameter.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_blog_carousel[values][list_order]", "options" => array('ASC' => 'Ascending', 'DESC' => 'Descending'), "value" => $list_order, "default" => "DESC", "dont_save" => true, "type" => "select"), array("name" => __("Custom Excerpts Size", 'rt_theme_admin'), "desc" => __('Give a number to change the charackter size of the post excerpts.', 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_blog_carousel[values][limit_chars]", "value" => $limit_chars, "type" => "text"), array("type" => "td_col"), array("name" => __("Carousel Style", 'rt_theme_admin'), "desc" => __('Select and set the carousel style.', 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_blog_carousel[values][style]", "options" => array("plain_carousel" => "Plain Box", "rounded_carousel" => "With Borders"), "default" => "1", "value" => $style, "type" => "select"), array("name" => __("Maximum Items", 'rt_theme_admin'), "desc" => __("Set the amount of blog posts to be displayed within the carousel.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_blog_carousel[values][max_item]", "min" => "1", "max" => "200", "class" => $randomClass, "value" => $max_item, "default" => "9", "dont_save" => true, "type" => "rangeinput"), array("name" => __("Content Layout", 'rt_theme_admin'), "desc" => __('Select and set the column layout for the carousel.', 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_blog_carousel[values][item_width]", "options" => array(5 => "1/5", 4 => "1/4", 3 => "1/3", 2 => "1/2", 1 => "1/1"), "default" => "1", "value" => $item_width, "hr" => "true", "type" => "select"), array("name" => __("Display Excerpts. (check to add blog excerpts to the carousel)", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_blog_carousel[values][display_excerpts]", "type" => "checkbox2", "class" => $randomClass, "value" => $display_excerpts, "default" => "on", "std" => "false"), array("name" => __("Crop Images (check to enable cropping of the blog post featured image)", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_blog_carousel[values][crop]", "type" => "checkbox2", "class" => $randomClass, "value" => $crop, "default" => "on", "std" => "false"), array("type" => "table_end")); echo $this->rt_generate_forms($options); echo '</div></div></div></li>'; }
function form($instance) { $title = isset($instance['title']) ? esc_attr($instance['title']) : ''; $categories = isset($instance['categories']) ? $instance['categories'] : array(); $newWidget = isset($instance['newWidget']) ? $instance['newWidget'] : ''; $limit = empty($instance['limit']) ? 100 : $instance['limit']; $count = empty($instance['count']) ? 5 : $instance['count']; $show_thumbnails = isset($instance['show_thumbnails']) ? $instance['show_thumbnails'] : ''; $show_excerpt = isset($instance['show_excerpt']) ? $instance['show_excerpt'] : ''; $thumb_width = empty($instance['thumb_width']) ? 260 : $instance['thumb_width']; $thumb_height = empty($instance['thumb_height']) ? 260 : $instance['thumb_height']; // Categories $rt_getcat = RTTheme::rt_get_categories(); ?> <p><label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title:', 'rt_theme_admin'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo $title; ?> " /></p> <p><label for="<?php echo $this->get_field_id('categories'); ?> "><?php _e('Select Categories:', 'rt_theme_admin'); ?> </label> <select class="widefat <?php echo empty($newWidget) ? '' : 'multiple'; ?> " name="<?php echo $this->get_field_name('categories'); ?> []" id="<?php echo $this->get_field_id('categories'); ?> " multiple="multiple" title="<?php _e('Select', 'rt_theme_admin'); ?> "> <?php foreach ($rt_getcat as $op_val => $option) { if ($categories) { foreach ($categories as $a_key => $a_value) { if ($a_value == $op_val) { $selected = "selected"; } } } ?> <option value="<?php echo $op_val; ?> " <?php echo empty($selected) ? "" : 'selected="selected"'; ?> > <?php echo $option; ?> </option> <?php $selected = ''; } ?> </select> <p><label for="<?php echo $this->get_field_id('count'); ?> "><?php _e('Number of posts to show:', 'rt_theme_admin'); ?> </label> <input id="<?php echo $this->get_field_id('count'); ?> " name="<?php echo $this->get_field_name('count'); ?> " type="text" value="<?php echo $count; ?> " size="4" /></p> <p><input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_excerpt'); ?> " name="<?php echo $this->get_field_name('show_excerpt'); ?> " <?php checked($show_excerpt); ?> /> <label for="<?php echo $this->get_field_id('show_excerpt'); ?> "><?php _e('Display Excerpt', 'rt_theme_admin'); ?> </label></p> <p><label for="<?php echo $this->get_field_id('limit'); ?> "><?php _e('Limit excerpt characters: ', 'rt_theme_admin'); ?> </label> <input id="<?php echo $this->get_field_id('limit'); ?> " name="<?php echo $this->get_field_name('limit'); ?> " type="text" value="<?php echo $limit; ?> " size="4" /></p> <p><input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_thumbnails'); ?> " name="<?php echo $this->get_field_name('show_thumbnails'); ?> " <?php checked($show_thumbnails); ?> /> <label for="<?php echo $this->get_field_id('show_thumbnails'); ?> "><?php _e('Don\'t display post thumbnails', 'rt_theme_admin'); ?> </label></p> <p><label for="<?php echo $this->get_field_id('thumb_width'); ?> "><?php _e('Thumbnail Width (px):', 'rt_theme_admin'); ?> </label> <input id="<?php echo $this->get_field_id('thumb_width'); ?> " name="<?php echo $this->get_field_name('thumb_width'); ?> " type="text" value="<?php echo $thumb_width; ?> " size="4" /></p> <p><label for="<?php echo $this->get_field_id('thumb_height'); ?> "><?php _e('Thumbnail Height (px):', 'rt_theme_admin'); ?> </label> <input id="<?php echo $this->get_field_id('thumb_height'); ?> " name="<?php echo $this->get_field_name('thumb_height'); ?> " type="text" value="<?php echo $thumb_height; ?> " size="4" /></p> <input class="widefat" id="<?php echo $this->get_field_id('newWidget'); ?> " name="<?php echo $this->get_field_name('newWidget'); ?> " type="hidden" value="1" /> <?php }
function form($instance) { $title = isset($instance['title']) ? esc_attr($instance['title']) : ''; $address = isset($instance['address']) ? esc_attr($instance['address']) : ''; $phone_1 = isset($instance['phone_1']) ? esc_attr($instance['phone_1']) : ''; $phone_2 = isset($instance['phone_2']) ? esc_attr($instance['phone_2']) : ''; $fax_1 = isset($instance['fax_1']) ? esc_attr($instance['fax_1']) : ''; $fax_2 = isset($instance['fax_2']) ? esc_attr($instance['fax_2']) : ''; $mail_1 = isset($instance['mail_1']) ? esc_attr($instance['mail_1']) : ''; $mail_2 = isset($instance['mail_2']) ? esc_attr($instance['mail_2']) : ''; $support_mail_1 = isset($instance['support_mail_1']) ? esc_attr($instance['support_mail_1']) : ''; $support_mail_2 = isset($instance['support_mail_2']) ? esc_attr($instance['support_mail_2']) : ''; $map_link = isset($instance['map_link']) ? esc_attr($instance['map_link']) : ''; $contact_form_link = isset($instance['contact_form_link']) ? esc_attr($instance['contact_form_link']) : ''; $map_link_text = isset($instance['map_link_text']) ? esc_attr($instance['map_link_text']) : ''; $contact_form_link_text = isset($instance['contact_form_link_text']) ? esc_attr($instance['contact_form_link_text']) : ''; // Categories $rt_getcat = RTTheme::rt_get_categories(); ?> <p><label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title:', 'rt_theme_admin'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo $title; ?> " /></p> <p><label for="<?php echo $this->get_field_id('address'); ?> "><?php _e('Address:', 'rt_theme_admin'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('address'); ?> " name="<?php echo $this->get_field_name('address'); ?> " type="text" value="<?php echo $address; ?> " /></p> <p><label for="<?php echo $this->get_field_id('phone_1'); ?> "><?php _e('Phone 1:', 'rt_theme_admin'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('phone_1'); ?> " name="<?php echo $this->get_field_name('phone_1'); ?> " type="text" value="<?php echo $phone_1; ?> " /></p> <p><label for="<?php echo $this->get_field_id('phone_2'); ?> "><?php _e('Phone 2:', 'rt_theme_admin'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('phone_2'); ?> " name="<?php echo $this->get_field_name('phone_2'); ?> " type="text" value="<?php echo $phone_2; ?> " /></p> <p><label for="<?php echo $this->get_field_id('fax_1'); ?> "><?php _e('Fax 1:', 'rt_theme_admin'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('fax_1'); ?> " name="<?php echo $this->get_field_name('fax_1'); ?> " type="text" value="<?php echo $fax_1; ?> " /></p> <p><label for="<?php echo $this->get_field_id('fax_2'); ?> "><?php _e('Fax 2:', 'rt_theme_admin'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('fax_2'); ?> " name="<?php echo $this->get_field_name('fax_2'); ?> " type="text" value="<?php echo $fax_2; ?> " /></p> <p><label for="<?php echo $this->get_field_id('mail_1'); ?> "><?php _e('Email 1:', 'rt_theme_admin'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('mail_1'); ?> " name="<?php echo $this->get_field_name('mail_1'); ?> " type="text" value="<?php echo $mail_1; ?> " /></p> <p><label for="<?php echo $this->get_field_id('mail_2'); ?> "><?php _e('Email 2:', 'rt_theme_admin'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('mail_2'); ?> " name="<?php echo $this->get_field_name('mail_2'); ?> " type="text" value="<?php echo $mail_2; ?> " /></p> <p><label for="<?php echo $this->get_field_id('support_mail_1'); ?> "><?php _e('Support Email 1:', 'rt_theme_admin'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('support_mail_1'); ?> " name="<?php echo $this->get_field_name('support_mail_1'); ?> " type="text" value="<?php echo $support_mail_1; ?> " /></p> <p><label for="<?php echo $this->get_field_id('support_mail_2'); ?> "><?php _e('Support Email 2:', 'rt_theme_admin'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('support_mail_2'); ?> " name="<?php echo $this->get_field_name('support_mail_2'); ?> " type="text" value="<?php echo $support_mail_2; ?> " /></p> <p><label for="<?php echo $this->get_field_id('contact_form_link'); ?> "><?php _e('Contact Form Link:', 'rt_theme_admin'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('contact_form_link'); ?> " name="<?php echo $this->get_field_name('contact_form_link'); ?> " type="text" value="<?php echo $contact_form_link; ?> " /></p> <p><label for="<?php echo $this->get_field_id('contact_form_link_text'); ?> "><?php _e('Contact Form Link Text:', 'rt_theme_admin'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('contact_form_link_text'); ?> " name="<?php echo $this->get_field_name('contact_form_link_text'); ?> " type="text" value="<?php echo empty($contact_form_link_text) ? __('Contact Form', 'rt_theme_admin') : $contact_form_link_text; ?> " /></p> <p><label for="<?php echo $this->get_field_id('map_link'); ?> "><?php _e('Map Link:', 'rt_theme_admin'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('map_link'); ?> " name="<?php echo $this->get_field_name('map_link'); ?> " type="text" value="<?php echo $map_link; ?> " /></p> <p><label for="<?php echo $this->get_field_id('map_link_text'); ?> "><?php _e('Map Link Text:', 'rt_theme_admin'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('map_link_text'); ?> " name="<?php echo $this->get_field_name('map_link_text'); ?> " type="text" value="<?php echo empty($map_link_text) ? __('Find us on map', 'rt_theme_admin') : $map_link_text; ?> " /></p> <?php }
function __construct() { // Pages $rt_getpages = RTTheme::rt_get_pages(); // Posts $this->posts = query_posts('posts_per_page=-1&post_type=post&orderby=title&order=ASC'); // Regular Posts $this->products = query_posts('posts_per_page=-1&post_type=products&orderby=title&order=ASC'); // Products $this->portfolios = query_posts('posts_per_page=-1&post_type=portfolio&orderby=title&order=ASC'); // Portfolios $rt_getposts = array(); foreach ($this->posts as $post_list) { // add regular posts to the list $rt_getposts[$post_list->ID] = '[' . $post_list->post_type . '] ' . $post_list->post_title; } foreach ($this->products as $post_list) { // add product posts to the list $rt_getposts[$post_list->ID] = '[' . $post_list->post_type . '] ' . $post_list->post_title; } foreach ($this->portfolios as $post_list) { // add portfolio posts to the list $rt_getposts[$post_list->ID] = '[' . $post_list->post_type . '] ' . $post_list->post_title; } // Categories $rt_getcat = RTTheme::rt_get_categories(); // Product Categories $rt_product_getcat = RTTheme::rt_get_product_categories(); // Portfolio Categories $rt_portfolio_getcat = RTTheme::rt_get_portfolio_categories(); // reset query wp_reset_query(); // get saved values $savedSidebars = get_option('rt_sidebar_options'); // create new sidebar array $savedSidebars_array = array(); // Count Sidebars $savedSidebars_IDs = array(); $sidebar_count = 0; if ($savedSidebars) { foreach ($savedSidebars as $key => $value) { if (!is_array($value)) { if (stristr($key, '_sidebar_name') == TRUE) { array_push($savedSidebars_IDs, $key); $sidebar_count++; } } } } // costruct saved array foreach ($savedSidebars_IDs as $id) { //sidebar $sidebar_name = $savedSidebars[$id]; $sidebar_id = str_replace("_sidebar_name", "", $id); $sidebar_pages = isset($savedSidebars[$sidebar_id . '_pages']) ? $savedSidebars[$sidebar_id . '_pages'] : ""; $sidebar_posts = isset($savedSidebars[$sidebar_id . '_posts']) ? $savedSidebars[$sidebar_id . '_posts'] : ""; $sidebar_categories = isset($savedSidebars[$sidebar_id . '_categories']) ? $savedSidebars[$sidebar_id . '_categories'] : ""; $sidebar_product_categories = isset($savedSidebars[$sidebar_id . '_productcategories']) ? $savedSidebars[$sidebar_id . '_productcategories'] : ""; $sidebar_portfolio_categories = isset($savedSidebars[$sidebar_id . '_portfoliocategories']) ? $savedSidebars[$sidebar_id . '_portfoliocategories'] : ""; //sidebar array array_push($savedSidebars_array, array("name" => $sidebar_name, "id" => $sidebar_id, "options" => array('pages' => $sidebar_pages, 'posts' => $sidebar_posts, 'categories' => $sidebar_categories, 'productcategories' => $sidebar_product_categories, 'portfoliocategories' => $sidebar_portfolio_categories))); } // costruct form arrays $options = array(); //template builder info text array_push($options, array("name" => __("Info", 'rt_theme_admin'), "desc" => __('If you need a new sidebar widget area for specified contents, you can create one by using Sidebar Creator. When you create a sidebar go to Appearence → <a href="widgets.php">Widgets</a> to drag&drop widgets into it.', 'rt_theme_admin'), "hr" => "true", "type" => "info")); foreach ($savedSidebars_array as $sidebar_v) { $sidebarID = $sidebar_v["id"]; //Sidebar Div array_push($options, array("id" => "div_" . $sidebarID, "name" => $sidebar_v["name"], "type" => "div")); //Sidebar Names array_push($options, array("name" => __("Sidebar Name", 'rt_theme_admin'), "value" => $sidebar_v["name"], "id" => $sidebarID . "_sidebar_name", "class" => "sidebar_name saved", "type" => "text")); //For Pages array_push($options, array("name" => __("Select Pages", 'rt_theme_admin'), "id" => $sidebar_v["id"] . "_pages[]", "options" => $rt_getpages, "default" => $sidebar_v["options"]["pages"], "purpose" => "sidebar", "type" => "selectmultiple")); //For Posts array_push($options, array("name" => __("Select Posts", 'rt_theme_admin'), "desc" => __("Regular Posts, Products, Portfolio", 'rt_theme_admin'), "id" => $sidebar_v["id"] . "_posts[]", "options" => $rt_getposts, "default" => $sidebar_v["options"]["posts"], "purpose" => "sidebar", "class" => "postlist", "type" => "selectmultiple")); //For Categories array_push($options, array("name" => __("Select Categories", 'rt_theme_admin'), "id" => $sidebar_v["id"] . "_categories[]", "options" => $rt_getcat, "default" => $sidebar_v["options"]["categories"], "purpose" => "sidebar", "type" => "selectmultiple")); //For Product Categories array_push($options, array("name" => __("Select Product Categories", 'rt_theme_admin'), "id" => $sidebar_v["id"] . "_productcategories[]", "options" => $rt_product_getcat, "default" => $sidebar_v["options"]["productcategories"], "purpose" => "sidebar", "type" => "selectmultiple")); //For Portfolio Categories array_push($options, array("name" => __("Select Portfolio Categories", 'rt_theme_admin'), "id" => $sidebar_v["id"] . "_portfoliocategories[]", "options" => $rt_portfolio_getcat, "default" => $sidebar_v["options"]["portfoliocategories"], "purpose" => "sidebar", "type" => "selectmultiple")); //Button array_push($options, array("name" => __("Delete Sidebar", 'rt_theme_admin'), "id" => $sidebar_v["id"] . "_delete", "class" => "deleteButton", "purpose" => "sidebar", "type" => "button")); //Sidebar Divend array_push($options, array("id" => "", "type" => "divend")); } // New Sidebar $sidebarID = 'sidebarid_' . rand(1, 100000); $sidebarName = $sidebarID . '_sidebar_name'; //Sidebar Div array_push($options, array("name" => __("Create New Sidebar", 'rt_theme_admin'), "id" => "div_" . $sidebarID, "class" => "new_sidebar", "type" => "div")); //Sidebar Names array_push($options, array("name" => __("Sidebar Name", 'rt_theme_admin'), "value" => "", "class" => "sidebar_name", "id" => $sidebarName, "type" => "text")); //For Pages array_push($options, array("name" => __("Select Pages", 'rt_theme_admin'), "id" => $sidebarID . "_pages[]", "options" => $rt_getpages, "default" => "", "purpose" => "sidebar", "type" => "selectmultiple")); //For Posts array_push($options, array("name" => __("Select Posts", 'rt_theme_admin'), "id" => $sidebarID . "_posts[]", "options" => $rt_getposts, "desc" => __("Regular Posts, Products, Portfolio", 'rt_theme_admin'), "default" => "", "class" => "postlist", "purpose" => "sidebar", "type" => "selectmultiple")); //For Categories array_push($options, array("name" => __("Select Categories", 'rt_theme_admin'), "id" => $sidebarID . "_categories[]", "options" => $rt_getcat, "default" => "", "purpose" => "sidebar", "type" => "selectmultiple")); //For Product Categories array_push($options, array("name" => __("Select Product Categories", 'rt_theme_admin'), "id" => $sidebarID . "_productcategories[]", "options" => $rt_product_getcat, "default" => "", "purpose" => "sidebar", "type" => "selectmultiple")); //For Portfolio Categories array_push($options, array("name" => __("Select Portfolio Categories", 'rt_theme_admin'), "id" => $sidebarID . "_portfoliocategories[]", "options" => $rt_portfolio_getcat, "default" => "", "purpose" => "sidebar", "type" => "selectmultiple")); //Send button array_push($options, array("name" => __("Create Sidebar", 'rt_theme_admin'), "id" => $sidebarID . "_send_button", "class" => "create_button sidebarCreate", "purpose" => "page_layouts", "type" => "send_button")); //Sidebar Divend array_push($options, array("id" => "", "type" => "divend")); $this->rt_generate_form_page($options); }
function generate_template_forms() { //remove module if woocommerce not installed if (!class_exists('Woocommerce')) { unset($this->rt_modules["woo_products_box"]); } //remove module if layerslider not installed if (!rt_check_layer_slider()) { unset($this->rt_modules["layerslider_box"]); } //remove module if revslider not installed if (!class_exists('RevSlider')) { unset($this->rt_modules["revslider_box"]); } // Pages $rt_getpages = RTTheme::rt_get_pages(); // Categories $rt_getcat = RTTheme::rt_get_categories(); // Product Categories $rt_product_getcat = RTTheme::rt_get_product_categories(); // Woo Product Categories if (class_exists('Woocommerce')) { $rt_woo_product_getcat = RTTheme::rt_get_woo_product_categories(); } // reset query wp_reset_query(); // get saved tempalates list $savedTemplatesList = get_option(RT_THEMESLUG . '_template_names_array'); // costruct form arrays $options = array(); //template builder info text array_push($options, array("name" => __("Info", 'rt_theme_admin'), "desc" => __('Template Builder is a build-in tool that lets you create custom page templates to use with your pages or posts. You are free to edit the default templates or create as many new templates as you wish. In order to use the templates edit a page or post and select the template name from the list under "RT-THEME TEMPLATE OPTIONS" box and save the page. To learn more, go to <a href="admin.php?page=rt_setup_assistant">Setup Assistant</a> and read "How To Use Template Builder".', 'rt_theme_admin'), "hr" => "true", "type" => "info")); if ($savedTemplatesList) { foreach ($savedTemplatesList as $TemplateID => $templateData) { // get saved templates list $savedTemplates = get_option(RT_THEMESLUG . '_template_names_array'); // get this tempalate data $thisTemplate = $this->get_template_data($TemplateID); if (is_object($thisTemplate)) { // init the form foreach ($thisTemplate->templates as $template) { //tempalte name $template_name = $templateData["name"]; //Start Form array_push($options, array("type" => "form_start", "template_id" => $TemplateID, "form_class" => "template_builder_form", "template_name" => $template_name)); //Hidden Value array_push($options, array("type" => "hidden", "id" => "templateBuilder", "value" => "true")); //End Form array_push($options, array("type" => "form_end")); } } } } // New Template $randomnumber = rand(1000, 1000000); $TemplateID = 'templateid_' . $randomnumber; $templateName = $TemplateID . '_template_name'; //Start Form array_push($options, array("type" => "form_start", "template_id" => $TemplateID, "form_class" => "template_builder_form", "template_name" => __("New Template #" . $randomnumber, 'rt_theme_admin'))); //Start header row array_push($options, array("id" => "templateid_" . $TemplateID . "_1_grid", "options" => array('group_id' => 1, 'part' => 'full', 'header_purpose' => true, 'footer_purpose' => false, 'newtemplate' => true), "purpose" => "page_layouts", "content_type" => "grid", "type" => "template_item")); //Start grid array_push($options, array("id" => "templateid_" . $TemplateID . "_2_grid", "options" => array('group_id' => 2, 'part' => 'full', 'header_purpose' => false, 'footer_purpose' => false), "purpose" => "page_layouts", "content_type" => "grid", "type" => "template_item")); //Start footer row array_push($options, array("id" => "templateid_" . $TemplateID . "_3_grid", "options" => array('group_id' => 3, 'part' => 'full', 'header_purpose' => false, 'footer_purpose' => true, 'newtemplate' => true), "purpose" => "page_layouts", "content_type" => "grid", "type" => "template_item")); //End Form array_push($options, array("type" => "form_end")); //template builder list templates array_push($options, array("type" => "list_templates", "templateID" => $TemplateID)); $this->rt_generate_form_page($options, 'template_builder', $TemplateID); }
function rt_generate_blog_box($theGroupID, $theTemplateID, $options, $randomClass) { $boxName = __("Blog Posts", "rt_theme_admin"); $contet_type = "blog_box"; $theTemplateID = str_replace('_' . $contet_type, '', $theTemplateID); $isNewBox = trim($randomClass) == "" ? false : true; $opacity = 1; $layout = $isNewBox ? 'full expanded"' : $options['layout']; $position = $isNewBox ? 'open minus' : 'plus'; $data_position = $isNewBox ? '' : 'display: none;'; $categories = $isNewBox ? '' : $options['categories']; $pagination = $isNewBox ? '' : $options['pagination']; $list_orderby = $isNewBox ? '' : $options['list_orderby']; $list_order = $isNewBox ? '' : $options['list_order']; $item_per_page = $isNewBox ? '' : $options['item_per_page']; echo '<li class="ui-state-default ' . $layout . '" style="opacity:' . $opacity . ';">'; echo '<div class="box_shadow"><div class="Itemholder"> <div class="Itemheader"><h5>' . $boxName . '</h5>'; echo '<div class="expand ' . $position . '"></div><div class="move"></div></div> <div class="ItemData" style="' . $data_position . '">'; echo '<input type="hidden" name="theTemplateID_' . $theGroupID . '" value="' . $theGroupID . '"><input type="hidden" name="theGroupID_' . $theGroupID . '" value="' . $theGroupID . '"><input type="hidden" name="source_type_' . $theGroupID . '" value="' . $contet_type . '">'; $options = array(array("desc" => __("This module displays posts according the options below.", 'rt_theme_admin'), "hr" => "true", "type" => "info_text_only"), array("value" => "one", "id" => $theTemplateID . '_' . $theGroupID . "_blog_box[layout]", "type" => "hidden"), array("name" => __("Select Post Categories", 'rt_theme_admin'), "desc" => __("You can select categories to filter posts that will be displayed with this module. If you don't select one, this module will display all posts.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_blog_box[categories][]", "options" => RTTheme::rt_get_categories(), "purpose" => "sidebar", "type" => "selectmultiple", "hr" => true, "class" => $randomClass, "default" => $categories), array("name" => __("OrderBy Parameter", 'rt_theme_admin'), "desc" => __("sort your posts by this parameter", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_blog_box[list_orderby]", "options" => array('author' => 'Author', 'date' => 'Date', 'title' => 'Title', 'modified' => 'Modified', 'ID' => 'ID', 'rand' => 'Randomized'), "hr" => true, "value" => $list_orderby, "default" => "date", "dont_save" => true, "type" => "select"), array("name" => __("Order", 'rt_theme_admin'), "desc" => __("Designates the ascending or descending order of the ORDERBY parameter", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_blog_box[list_order]", "options" => array('ASC' => 'Ascending', 'DESC' => 'Descending'), "value" => $list_order, "default" => "DESC", "dont_save" => true, "hr" => true, "type" => "select"), array("name" => __("Amount of blog post per page", 'rt_theme_admin'), "desc" => __("How many posts do you want to display per page?", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_blog_box[item_per_page]", "min" => "1", "max" => "200", "class" => $randomClass, "value" => $item_per_page, "default" => "9", "dont_save" => true, "hr" => true, "type" => "rangeinput"), array("name" => __("Pagination", 'rt_theme_admin'), "desc" => __("Adds page navigation under the posts.", 'rt_theme_admin'), "id" => $theTemplateID . '_' . $theGroupID . "_blog_box[pagination]", "type" => "checkbox", "class" => $randomClass, "value" => $pagination, "hr" => true, "default" => "off", "std" => "false"), array("name" => __("delete", 'rt_theme_admin'), "id" => "_delete", "class" => "deleteButton template_box_delete", "purpose" => "page_template", "type" => "button"), array("name" => __("close", 'rt_theme_admin'), "id" => "_close", "class" => "closeButton template_box_close", "purpose" => "page_template", "type" => "button")); echo $this->rt_generate_forms($options); echo '</div></div></div></li>'; }
function __construct() { // Items $rt_items = array("slider_box" => "Slider", "revolution_box" => "Revolution Slider", "blog_box" => "Blog Posts", "contact_info_box" => "Contact Info", "contact_form" => "Contact Form", "google_map" => "Google Map", "all_content_boxes" => "Home Page Content", "portfolio_box" => "Portfolio", "product_box" => "Product", "woo_products_box" => "WooCommerce Products", "sidebar_box" => "Widget Area - Sidebar", "default_content" => "Default Content + Page Title", "banner_box" => "Banner Box", "heading_bar" => "Heading Bar", "code_box" => "Code Box"); //remove module if woocommerce not installed if (!class_exists('Woocommerce')) { unset($rt_items["woo_products_box"]); } // Pages $rt_getpages = RTTheme::rt_get_pages(); // Categories $rt_getcat = RTTheme::rt_get_categories(); // Product Categories $rt_product_getcat = RTTheme::rt_get_product_categories(); // Woo Product Categories if (class_exists('Woocommerce')) { $rt_woo_product_getcat = RTTheme::rt_get_woo_product_categories(); } // reset query wp_reset_query(); // get saved values $savedTemplates = get_option('rt_page_layouts'); // costruct form arrays $options = array(); //template builder info text array_push($options, array("name" => __("Info", 'rt_theme_admin'), "desc" => __('Template Builder is a built-in tool that lets you create custom page templates to use with your pages or posts. You are free to edit the default templates or create a new one as you wish. In order to use this templates edit a page or post and select the template name from the list under "RT-THEME TEMPLATE OPTIONS" box and save the page. To learn more, go to <a href="admin.php?page=rt_setup_assistant">Setup Assistant</a> and read "How To Use Template Builder".', 'rt_theme_admin'), "hr" => "true", "type" => "info")); if ($savedTemplates) { foreach ($savedTemplates->templates as $template) { $TemplateID = $template->templateID; $template_name = $template->templateName; $lineUp = isset($template->lineup) ? $template->lineup : ""; //Temlates Div array_push($options, array("id" => "div_" . $TemplateID, "name" => $template_name, "type" => "div")); //Template Name array_push($options, array("name" => __("Template Name", 'rt_theme_admin'), "value" => $template_name, "id" => $TemplateID . "_template_name", "class" => "sidebar_name saved", "hr" => "true", "type" => "text")); //Sidebar selection array_push($options, array("name" => __("Select a Page Layout", 'rt_theme_admin'), "id" => $TemplateID . "_sidebarSelection", "options" => array("full" => "Full Width", "left" => "Left Sidebar", "right" => "Right Sidebar"), "value" => $template->sidebar, "purpose" => "page_layouts", "hr" => "true", "class" => "layout_selector", "type" => "radio")); //Create Item Select List array_push($options, array("name" => __("Module List", 'rt_theme_admin'), "id" => $TemplateID . "_item_list", "options" => $rt_items, "default" => "", "purpose" => "sidebar", "sidebuttonName" => "Add", "sidebuttonClass" => "rt_template_item_add_button add_button", "type" => "select")); //Heading array_push($options, array("name" => __("Modules", 'rt_theme_admin'), "id" => $TemplateID . "_header", "default" => "", "purpose" => "page_layouts", "type" => "heading")); //Create Grid First Part array_push($options, array("id" => $TemplateID . "_grid", "purpose" => "page_layouts", "type" => "grid", "part" => "first")); if (isset($template->contents) && is_array($template->contents)) { foreach ($template->contents as $templateContents) { //possible empty values - fix php warnings $templateContents->categories = isset($templateContents->categories) ? $templateContents->categories : ""; $templateContents->thumbs_width = isset($templateContents->thumbs_width) ? $templateContents->thumbs_width : ""; $templateContents->thumbs_height = isset($templateContents->thumbs_height) ? $templateContents->thumbs_height : ""; $templateContents->filterable = isset($templateContents->filterable) ? $templateContents->filterable : ""; $templateContents->list_order = isset($templateContents->list_order) ? $templateContents->list_order : ""; //Call Home Page Box if ($templateContents->content_type == "home_page_box") { array_push($options, array("id" => $TemplateID . "_home_page_contents", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'content_id' => $templateContents->content_id), "purpose" => "page_layouts", "content_type" => "home_page_box", "type" => "template_item")); } //Call Portfolio Posts if ($templateContents->content_type == "portfolio_box") { array_push($options, array("id" => $TemplateID . "_portfolio_posts", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'categories' => @$templateContents->categories, 'pagination' => $templateContents->pagination, 'item_width' => $templateContents->item_width, 'portf_list_orderby' => $templateContents->portf_list_orderby, 'portf_list_order' => $templateContents->portf_list_order, 'item_per_page' => $templateContents->item_per_page, 'filterable' => $templateContents->filterable), "purpose" => "page_layouts", "content_type" => "portfolio_box", "type" => "template_item")); } //Call Sidebar Box if ($templateContents->content_type == "sidebar_box") { array_push($options, array("id" => $TemplateID . "_sidebar_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'sidebar_id' => $templateContents->sidebar_id, 'widget_box_width' => $templateContents->widget_box_width), "purpose" => "page_layouts", "content_type" => "sidebar_box", "type" => "template_item")); } //Call Default Content Box if ($templateContents->content_type == "default_content") { array_push($options, array("id" => $TemplateID . "_default_content", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'heading' => $templateContents->heading), "purpose" => "page_layouts", "content_type" => "default_content", "type" => "template_item")); } //Call All content boxes if ($templateContents->content_type == "all_content_boxes") { array_push($options, array("id" => $TemplateID . "_all_content_boxes", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'content_id' => $templateContents->content_id, 'item_width' => $templateContents->item_width, 'list_orderby' => $templateContents->list_orderby, 'list_order' => $templateContents->list_order), "purpose" => "page_layouts", "content_type" => "all_content_boxes", "type" => "template_item")); } //Call banner boxes if ($templateContents->content_type == "banner_box") { array_push($options, array("id" => $TemplateID . "_banner_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'text' => stripslashes($templateContents->text), 'button_text' => $templateContents->button_text, 'button_link' => $templateContents->button_link), "purpose" => "page_layouts", "content_type" => "banner_box", "type" => "template_item")); } //Call slider boxes if ($templateContents->content_type == "slider_box") { array_push($options, array("id" => $TemplateID . "_slider_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'slider_script' => $templateContents->slider_script, 'content_id' => $templateContents->content_id, 'slider_timeout' => $templateContents->slider_timeout, 'slider_height' => $templateContents->slider_height, 'image_resize' => $templateContents->image_resize, 'image_crop' => $templateContents->image_crop, 'list_orderby' => $templateContents->list_orderby, 'list_order' => $templateContents->list_order, 'slider_buttons' => $templateContents->slider_buttons, 'slider_thumbs' => $templateContents->slider_thumbs, 'thumbs_width' => $templateContents->thumbs_width, 'thumbs_height' => $templateContents->thumbs_height, 'slider_effect' => $templateContents->slider_effect), "purpose" => "page_layouts", "content_type" => "slider_box", "type" => "template_item")); } //Call revolution slider boxes if ($templateContents->content_type == "revolution_box") { array_push($options, array("id" => $TemplateID . "_revolution_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'slider_id' => $templateContents->slider_id), "purpose" => "page_layouts", "content_type" => "revolution_box", "type" => "template_item")); } //Call product boxes if ($templateContents->content_type == "product_box") { array_push($options, array("id" => $TemplateID . "_product_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'item_width' => $templateContents->item_width, 'ajax_scroller' => @$templateContents->ajax_scroller, 'pagination' => $templateContents->pagination, 'list_orderby' => $templateContents->list_orderby, 'list_order' => $templateContents->list_order, 'categories' => @$templateContents->categories, 'item_per_page' => $templateContents->item_per_page), "purpose" => "page_layouts", "content_type" => "product_box", "type" => "template_item")); } if (class_exists('Woocommerce')) { //Call woo product boxes if ($templateContents->content_type == "woo_products_box") { array_push($options, array("id" => $TemplateID . "_woo_products_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'item_width' => $templateContents->item_width, 'list_orderby' => $templateContents->list_orderby, 'list_order' => $templateContents->list_order, 'categories' => @$templateContents->categories, 'item_per_page' => $templateContents->item_per_page), "purpose" => "page_layouts", "content_type" => "woo_products_box", "type" => "template_item")); } } //Call blog boxes if ($templateContents->content_type == "blog_box") { array_push($options, array("id" => $TemplateID . "_blog_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'pagination' => $templateContents->pagination, 'list_orderby' => $templateContents->list_orderby, 'list_order' => @$templateContents->list_order, 'categories' => @$templateContents->categories, 'item_per_page' => $templateContents->item_per_page), "purpose" => "page_layouts", "content_type" => "blog_box", "type" => "template_item")); } //Call google map if ($templateContents->content_type == "google_map") { array_push($options, array("id" => $TemplateID . "_google_map", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'map_url' => stripslashes($templateContents->map_url), 'height' => $templateContents->height), "purpose" => "page_layouts", "content_type" => "google_map", "type" => "template_item")); } //Call contact form if ($templateContents->content_type == "contact_form") { array_push($options, array("id" => $TemplateID . "_contact_form", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'title' => stripslashes($templateContents->title), 'email' => $templateContents->email, 'shortcode' => stripslashes($templateContents->shortcode), 'description' => stripslashes($templateContents->description)), "purpose" => "page_layouts", "content_type" => "contact_form", "type" => "template_item")); } //Call contact info box if ($templateContents->content_type == "contact_info_box") { array_push($options, array("id" => $TemplateID . "_contact_info_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'contact_title' => stripslashes($templateContents->contact_title), 'contact_text' => stripslashes($templateContents->contact_text), 'address' => stripslashes($templateContents->address), 'phone' => stripslashes($templateContents->phone), 'email' => stripslashes($templateContents->email), 'support_email' => stripslashes($templateContents->support_email), 'fax' => stripslashes($templateContents->fax)), "purpose" => "page_layouts", "content_type" => "contact_info_box", "type" => "template_item")); } //Call heading bar if ($templateContents->content_type == "heading_bar") { array_push($options, array("id" => $TemplateID . "_heading_bar", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'heading' => stripslashes($templateContents->heading)), "purpose" => "page_layouts", "content_type" => "heading_bar", "type" => "template_item")); } //Call code box if ($templateContents->content_type == "code_box") { array_push($options, array("id" => $TemplateID . "_code_box", "options" => array('group_id' => $templateContents->group_id, 'layout' => $templateContents->layout, 'heading' => stripslashes($templateContents->heading), 'code_space' => stripslashes($templateContents->code_space), 'transparent' => stripslashes($templateContents->transparent), 'no_padding' => stripslashes($templateContents->no_padding)), "purpose" => "page_layouts", "content_type" => "code_box", "type" => "template_item")); } } } //Create Grid Second Part array_push($options, array("id" => $TemplateID . "_grid", "purpose" => "page_layouts", "type" => "grid", "part" => "second")); //Delete Button if ($TemplateID != "templateid_001" && $TemplateID != "templateid_002" && $TemplateID != "templateid_003" && $TemplateID != "templateid_004" && $TemplateID != "templateid_005") { array_push($options, array("name" => __("Delete Template", 'rt_theme_admin'), "id" => $TemplateID . "_delete", "class" => "deleteButton deteleTemplateButton", "purpose" => "sidebar", "type" => "button")); } //Sidebar Divend array_push($options, array("id" => "", "type" => "divend")); } } // New Sidebar $templateID = 'templateid_' . rand(1000, 1000000); $templateName = $templateID . '_template_name'; //Sidebar Div array_push($options, array("name" => __("Create New Template", 'rt_theme_admin'), "id" => "div_" . $templateID, "class" => "new_sidebar", "type" => "div")); //Template Names array_push($options, array("name" => __("Template Name", 'rt_theme_admin'), "value" => "", "class" => "sidebar_name", "hr" => "true", "id" => $templateName, "type" => "text")); //Sidebar selection array_push($options, array("name" => __("Select a Page Layout", 'rt_theme_admin'), "id" => $templateID . "_sidebarSelection", "options" => array("full" => "Full Width", "left" => "Left Sidebar", "right" => "Right Sidebar"), "value" => "full", "purpose" => "page_layouts", "class" => "layout_selector", "hr" => "true", "type" => "radio")); //Create Item Select List array_push($options, array("name" => __("Module List", 'rt_theme_admin'), "id" => $templateID . "_item_list", "options" => $rt_items, "default" => "", "purpose" => "sidebar", "sidebuttonName" => "Add", "sidebuttonClass" => "rt_template_item_add_button add_button", "type" => "select")); //Heading array_push($options, array("name" => __("Modules", 'rt_theme_admin'), "id" => $templateID . "_header", "default" => "", "purpose" => "page_layouts", "type" => "heading")); //Create Grid array_push($options, array("id" => $templateID . "_grid", "purpose" => "page_layouts", "type" => "grid", "part" => "full")); //Send button array_push($options, array("name" => __("Create Template", 'rt_theme_admin'), "id" => $templateID . "_send_button", "class" => "create_button", "purpose" => "page_layouts", "type" => "send_button")); //Sidebar Divend array_push($options, array("id" => "", "type" => "divend")); $this->rt_generate_form_page($options); }
function form($instance) { $title = isset($instance['title']) ? esc_attr($instance['title']) : ''; $testimonial = isset($instance['testimonial']) ? esc_attr($instance['testimonial']) : ''; $from = isset($instance['from']) ? esc_attr($instance['from']) : ''; // Categories $rt_getcat = RTTheme::rt_get_categories(); ?> <p><label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title:', 'rt_theme_admin'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo $title; ?> " /></p> <p><label for="<?php echo $this->get_field_id('testimonial'); ?> "><?php _e('Testimonial:', 'rt_theme_admin'); ?> </label> <textarea class="widefat" id="<?php echo $this->get_field_id('testimonial'); ?> " name="<?php echo $this->get_field_name('testimonial'); ?> "><?php echo $testimonial; ?> </textarea> </p> <p><label for="<?php echo $this->get_field_id('from'); ?> "><?php _e('From:', 'rt_theme_admin'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('from'); ?> " name="<?php echo $this->get_field_name('from'); ?> " type="text" value="<?php echo $from; ?> " /></p> <?php }