function form($instance) { $instance = wp_parse_args((array) $instance, $this->instance_defaults); ?> <!-- Widget Title: Text Input --> <p> <label for="<?php echo esc_attr($this->get_field_id('title')); ?> "><?php _e('Title:', 'om_portfolio'); ?> </label> <input class="widefat" type="text" id="<?php echo esc_attr($this->get_field_id('title')); ?> " name="<?php echo esc_attr($this->get_field_name('title')); ?> " value="<?php echo esc_attr($instance['title']); ?> " /> </p> <!-- Postcount: Text Input --> <p> <label for="<?php echo esc_attr($this->get_field_id('postcount')); ?> "><?php _e('Number of posts', 'om_portfolio'); ?> </label> <input type="text" class="widefat" id="<?php echo esc_attr($this->get_field_id('postcount')); ?> " name="<?php echo esc_attr($this->get_field_name('postcount')); ?> " value="<?php echo esc_attr($instance['postcount']); ?> " /> </p> <!-- Layout --> <p> <label for="<?php echo esc_attr($this->get_field_id('preview_layout')); ?> "><?php _e('Preview layout', 'om_portfolio'); ?> </label> <select id="<?php echo esc_attr($this->get_field_id('preview_layout')); ?> " name="<?php echo esc_attr($this->get_field_name('preview_layout')); ?> "> <?php $opts = ompf_get_options_arr('preview_layout'); foreach ($opts as $k => $v) { echo '<option value="' . $k . '"' . ($k == $instance['preview_layout'] ? ' selected="selected"' : '') . '>' . $v . '</option>'; } ?> </select> </p> <!-- Ratio: Text Input --> <p> <label for="<?php echo esc_attr($this->get_field_id('ratio')); ?> "><?php _e('Thumbnails width/height ratio', 'om_portfolio'); ?> </label> <select id="<?php echo esc_attr($this->get_field_id('ratio')); ?> " name="<?php echo esc_attr($this->get_field_name('ratio')); ?> "> <?php $opts = ompf_get_options_arr('ratio'); foreach ($opts as $k => $v) { echo '<option value="' . $v . '"' . ($v == $instance['ratio'] ? ' selected="selected"' : '') . '>' . $v . '</option>'; } ?> </select> </p> <!-- Randomize: Check Box --> <p> <label for="<?php echo esc_attr($this->get_field_id('randomize')); ?> "><?php _e('Randomize items', 'om_portfolio'); ?> </label> <input type="checkbox" id="<?php echo esc_attr($this->get_field_id('randomize')); ?> " name="<?php echo esc_attr($this->get_field_name('randomize')); ?> " value="true" <?php if ($instance['randomize'] == 'true') { echo 'checked="checked"'; } ?> /> </p> <!-- Category: Select Box --> <p> <label for="<?php echo $this->get_field_id('category'); ?> "><?php _e('Portfolio category:', 'om_portfolio'); ?> </label> <?php $args = array('show_option_all' => __('All Categories', 'om_portfolio'), 'show_option_none' => __('No Categories', 'om_portfolio'), 'hide_empty' => 0, 'echo' => 1, 'selected' => $instance['category'], 'hierarchical' => 0, 'name' => $this->get_field_name('category'), 'id' => $this->get_field_id('category'), 'class' => '', 'depth' => 0, 'tab_index' => 0, 'taxonomy' => 'portfolio-type', 'hide_if_empty' => false); wp_dropdown_categories($args); ?> </p> <!-- Custom items: Text Input --> <p> <label for="<?php echo esc_attr($this->get_field_id('ids')); ?> "><?php _e('Custom portfolio item IDs', 'om_portfolio'); ?> </label> <input type="text" class="widefat" id="<?php echo esc_attr($this->get_field_id('ids')); ?> " name="<?php echo esc_attr($this->get_field_name('ids')); ?> " value="<?php echo esc_attr($instance['ids']); ?> " /> </p> <?php }
<?php $ompf_portfolio_options = array('portfolio_prev_next' => array('name' => __('Previous/next item links on single portfolio page', 'om_portfolio'), 'desc' => '', 'id' => 'ompf_portfolio_prev_next', 'std' => 'none', 'options' => array('none' => __('Hide links', 'om_portfolio'), 'all' => __('Show Prev/next links on all portfolio items', 'om_portfolio'), 'category' => __('Show Prev/next links on portfolio items only from the same category', 'om_portfolio')), 'type' => 'select'), 'portfolio_slug' => array('name' => __('Custom portfolio URL directory', 'om_portfolio'), 'desc' => __('when using custom permalinks wordpress mode you can change the "portfolio" key in URLs like website.com/portfolio/item-name/', 'om_portfolio'), 'id' => 'ompf_portfolio_slug', 'std' => '', 'type' => 'text'), 'portfolio_cat_slug' => array('name' => __('Custom portfolio category URL directory', 'om_portfolio'), 'desc' => __('when using custom permalinks wordpress mode you can change the "portfolio-type" key in URLs like website.com/portfolio-type/category-name/', 'om_portfolio'), 'id' => 'ompf_portfolio_cat_slug', 'std' => '', 'type' => 'text'), 'random_notice' => array("name" => "", 'id' => 'random_notice', "message" => '<b style="font-size:130%">' . __('Random items on single page:', 'om_portfolio') . '</b>', "type" => "intro"), 'portfolio_single_show_random' => array('name' => __('Show random portfolio items on single portfolio page', 'om_portfolio'), 'desc' => '', 'id' => 'ompf_portfolio_single_show_random', 'std' => '', 'options' => array_merge(array('' => __('No', 'om_portfolio')), ompf_get_options_arr('size')), 'type' => 'select'), 'portfolio_single_random_ratio' => array('name' => __('Random portfolio items thumbnail width/height ratio', 'om_portfolio'), 'desc' => '', 'id' => 'ompf_portfolio_single_random_ratio', 'std' => '1.5', 'options' => ompf_get_options_arr('ratio'), 'type' => 'select'), 'portfolio_random_title' => array('name' => __('Title for random items', 'om_portfolio'), 'desc' => '', 'id' => 'ompf_portfolio_random_title', 'std' => __('Random Items', 'om_portfolio'), 'type' => 'text'), 'archive_notice' => array("name" => "", 'id' => 'archive_notice', "message" => '<b style="font-size:130%">' . __('Archive/Category page', 'om_portfolio') . '</b>', "type" => "intro"), 'archive_portfolio_per_page' => array('name' => __('Number of items per page', 'om_portfolio'), 'desc' => __('Leave empty to use standard value'), 'id' => 'ompf_archive_portfolio_per_page', 'std' => '9', 'type' => 'text')); function ompf_portfolio_set_default_options() { global $ompf_portfolio_options; if (is_admin() && get_option('ompf_plugin_just_activated')) { delete_option('ompf_plugin_just_activated'); foreach ($ompf_portfolio_options as $option) { if (isset($option['id']) && isset($option['std'])) { $db_option = get_option($option['id']); if ($db_option === false) { update_option($option['id'], $option['std']); } } } } } add_action('admin_init', 'ompf_portfolio_set_default_options'); function ompf_portfolio_options_modify() { global $ompf_portfolio_options; $ompf_portfolio_options = apply_filters('ompf_portfolio_options', $ompf_portfolio_options); } add_action('admin_init', 'ompf_portfolio_options_modify');
/** * Testimonials */ if (isset($GLOBALS['omTestimonialsPlugin'])) { vc_map(array('name' => __('Testimonials', 'om_theme'), 'base' => 'om_testimonials', 'icon' => 'om-wpb-icon-testimonials', 'category' => array(__('Content', 'js_composer')), 'description' => __('Testimonials block', 'om_theme'), 'params' => array(array('type' => 'om_info', 'heading' => '', 'param_name' => 'info', 'description' => sprintf(__('Testimonials are managed under <a href="%s" target="_blank">"Testimonials"</a> section. This block just displays testimonials.', 'om_theme'), admin_url('edit.php?post_type=testimonials'))), array('type' => 'textfield', 'heading' => __('Widget title', 'js_composer'), 'param_name' => 'title', 'description' => __('Enter text which will be used as widget title. Leave blank if no title is needed.', 'js_composer')), array('type' => 'dropdown', 'heading' => __('Layout mode', 'om_theme'), 'param_name' => 'mode', 'admin_label' => true, 'value' => array(__('In one box with sliding', 'om_theme') => 'box', __('Full list', 'om_theme') => 'list')), array('type' => 'textfield', 'heading' => __('Autorotate for box mode', 'om_theme'), 'param_name' => 'timeout', 'value' => '', 'description' => __('Interval in milliseconds. Leave empty to disable autorotate', 'om_theme'), 'dependency' => array('element' => 'mode', 'value' => array('box'))), array('type' => 'checkbox', 'heading' => __('Pause autorotate on hover', 'om_theme'), 'param_name' => 'pause', 'value' => array(__('Yes, please', 'js_composer') => 'yes'), 'dependency' => array('element' => 'timeout', 'not_empty' => true)), array('type' => 'om_categories', 'heading' => __('Testimonials category', 'js_composer'), 'param_name' => 'category', 'args' => array('taxonomy' => 'testimonials-type'), 'description' => __('Choose a category, to display testimonials from certain category.', 'om_theme')), array('type' => 'textfield', 'heading' => __('Testimonials by ID', 'js_composer'), 'param_name' => 'ids', 'description' => __('Specify a list of testimonial IDs separated with a comma to display certain testimonials.', 'js_composer')), array('type' => 'checkbox', 'heading' => __('Randomize testimonials', 'om_theme'), 'param_name' => 'randomize', 'value' => array(__('Yes, please', 'js_composer') => 'yes')), array('type' => 'textfield', 'heading' => __('Extra class name', 'js_composer'), 'param_name' => 'el_class', 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'js_composer'))))); if (class_exists('WPBakeryShortCode')) { class WPBakeryShortCode_om_testimonials extends WPBakeryShortCode { } } } /** * Olevmedia Portfolio */ if (isset($GLOBALS['omPortfolioPlugin']) && version_compare($GLOBALS['omPortfolioPlugin']['version'], '2.0.0', '>=')) { vc_map(array('name' => __('Portfolio', 'om_theme'), 'base' => 'om_portfolio', 'icon' => 'om-wpb-icon-portfolio', 'category' => array(__('Content', 'js_composer')), 'description' => __('Portfolio items block', 'om_theme'), 'params' => array(array('type' => 'textfield', 'heading' => __('Widget title', 'js_composer'), 'param_name' => 'title', 'description' => __('Enter text which will be used as widget title. Leave blank if no title is needed.', 'js_composer')), array('type' => 'dropdown', 'heading' => __('Layout', 'om_theme'), 'param_name' => 'layout', 'admin_label' => true, 'value' => array_flip(ompf_get_options_arr('layout'))), array('type' => 'dropdown', 'heading' => __('Thumbnail width/height ratio', 'om_theme'), 'param_name' => 'ratio', 'admin_label' => true, 'value' => array_values(ompf_get_options_arr('ratio')), 'dependency' => array('element' => 'layout', 'value' => array('fixed'))), array('type' => 'dropdown', 'heading' => __('Thumbnail size', 'om_theme'), 'param_name' => 'size', 'admin_label' => true, 'value' => array_flip(ompf_get_options_arr('size'))), array('type' => 'dropdown', 'heading' => __('Preview layout', 'om_theme'), 'param_name' => 'preview_layout', 'admin_label' => true, 'value' => array_flip(ompf_get_options_arr('preview_layout'))), array('type' => 'dropdown', 'heading' => __('Item margins', 'om_theme'), 'param_name' => 'margins', 'value' => array(__('Standard', 'om_theme') => 'standard', __('No margins', 'om_theme') => 'none'), 'description' => __('Gap between portfolio items in the grid', 'om_theme')), array('type' => 'textfield', 'heading' => __('Count', 'om_theme'), 'param_name' => 'count', 'value' => '', 'description' => __('Number of items to display. Leave empty to display all items.', 'om_theme')), array('type' => 'checkbox', 'heading' => __('Use hi-res images', 'om_theme'), 'description' => __('Check this option of you use element in a row without padding and the dimendions of images is not enough.', 'om_theme'), 'param_name' => 'hires', 'value' => array(__('Yes, please', 'om_theme') => 'yes')), array('type' => 'om_categories', 'heading' => __('Category', 'js_composer'), 'param_name' => 'category', 'args' => array('taxonomy' => 'portfolio-type'), 'description' => __('Choose a category, to display portfolio items from certain category.', 'om_theme')), array('type' => 'textfield', 'heading' => __('Portfolio items by ID', 'js_composer'), 'param_name' => 'ids', 'description' => __('Specify a list of portfolio item IDs separated with a comma to display certain items.', 'js_composer')), array('type' => 'dropdown', 'heading' => __('Items order', 'om_theme'), 'param_name' => 'sort', 'value' => array_flip(ompf_get_options_arr('sort'))), array('type' => 'checkbox', 'heading' => __('Randomize items', 'om_theme'), 'param_name' => 'randomize', 'value' => array(__('Yes, please', 'js_composer') => 'yes')), array('type' => 'textfield', 'heading' => __('Extra class name', 'js_composer'), 'param_name' => 'el_class', 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'js_composer'))))); if (class_exists('WPBakeryShortCode')) { class WPBakeryShortCode_om_portfolio extends WPBakeryShortCode { } } } /** * Logos */ vc_map(array('name' => __('Logos', 'om_theme'), 'base' => 'om_logos', 'icon' => 'om-wpb-icon-logos', 'category' => array(__('Content', 'js_composer')), 'description' => __('Align set of logotypes', 'om_theme'), 'params' => array(array('type' => 'textfield', 'heading' => __('Widget title', 'js_composer'), 'param_name' => 'title', 'description' => __('Enter text which will be used as widget title. Leave blank if no title is needed.', 'js_composer')), array('type' => 'attach_images', 'heading' => __('Images', 'om_theme'), 'description' => __('Choose image to display.', 'js_composer'), 'param_name' => 'images'), array('type' => 'textfield', 'heading' => __('Image size', 'js_composer'), 'param_name' => 'img_size', 'value' => 'full', 'description' => __('Enter image size. Example: "thumbnail", "medium", "large", "full" or other sizes defined by current theme. Alternatively enter image size in pixels: 200x100 (Width x Height). Leave empty to use "full" size.', 'om_theme')), array('type' => 'dropdown', 'heading' => __('On click', 'om_theme'), 'param_name' => 'onclick', 'value' => array(__('Do nothing', 'om_theme') => 'no', __('Open custom link', 'om_theme') => 'custom_link', __('Open link, defined in the "Description" field of an image', 'om_theme') => 'description')), array('type' => 'exploded_textarea', 'heading' => __('Custom links', 'js_composer'), 'param_name' => 'custom_links', 'description' => __('Enter links for each image. Divide links with linebreaks (Enter) . ', 'om_theme'), 'dependency' => array('element' => 'onclick', 'value' => array('custom_link'))), array('type' => 'dropdown', 'heading' => __('Link target', 'om_theme'), 'param_name' => 'links_target', 'description' => __('Select where to open custom links.', 'js_composer'), 'dependency' => array('element' => 'onclick', 'value' => array('custom_link', 'description')), 'value' => array(__('Same window', 'js_composer') => '_self', __('New window', 'js_composer') => '_blank')), array('type' => 'textfield', 'heading' => __('Extra class name', 'js_composer'), 'param_name' => 'el_class', 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'js_composer'))))); if (class_exists('WPBakeryShortCode')) { class WPBakeryShortCode_om_logos extends WPBakeryShortCode { } }
/************************************************************************************* * Add MetaBox to Page edit page *************************************************************************************/ $ompf_page_meta_box = array('portfolio' => array('id' => 'ompf-page-meta-box-portfolio', 'name' => __('Portfolio options', 'om_portfolio'), 'fields' => array('ompf_portfolio_display' => array('name' => __('Display Portfolio on this page', 'om_portfolio'), 'desc' => '', 'id' => 'ompf_portfolio_display', 'type' => 'select', 'std' => '0', 'options' => array('0' => __('No', 'om_portfolio'), '1' => __('Yes', 'om_portfolio'))), 'ompf_portfolio_layout' => array('name' => __('Portfolio layout', 'om_portfolio'), 'desc' => '', 'id' => 'ompf_portfolio_layout', 'type' => 'select', 'std' => 'fixed', 'options' => ompf_get_options_arr('layout')), 'ompf_portfolio_thumbs_size' => array('name' => __('Thumbnail size', 'om_portfolio'), 'desc' => '', 'id' => 'ompf_portfolio_thumbs_size', 'type' => 'select', 'std' => 'medium', 'options' => ompf_get_options_arr('size')), 'ompf_portfolio_fixed_ratio' => array('name' => __('Thumbnail width/height ratio', 'om_portfolio'), 'desc' => __('If fixed cells layout chosen above choose the ratio', 'om_portfolio'), 'id' => 'ompf_portfolio_fixed_ratio', 'type' => 'select', 'std' => '1.5', 'options' => ompf_get_options_arr('ratio'), 'code' => ' <script> jQuery(function($){ $("#ompf_portfolio_layout").change(function(){ if($(this).val() == "fixed") { $("#ompf_portfolio_fixed_ratio").parents("tr").show(); } else { $("#ompf_portfolio_fixed_ratio").parents("tr").hide(); } }).change(); }); </script> '), 'ompf_portfolio_preview_layout' => array('name' => __('Preview layout', 'om_portfolio'), 'desc' => '', 'id' => 'ompf_portfolio_preview_layout', 'type' => 'select', 'std' => 'full', 'options' => ompf_get_options_arr('preview_layout')), 'ompf_portfolio_item_margins' => array('name' => __('Item margins', 'om_portfolio'), 'desc' => __('Gap between portfolio items in the grid', 'om_portfolio'), 'id' => 'ompf_portfolio_item_margins', 'type' => 'select', 'std' => 'standard', 'options' => array('standard' => __('Standard', 'om_portfolio'), 'none' => __('No margins', 'om_portfolio'))), 'ompf_portfolio_full_width' => array('name' => __('Expand to full width', 'om_portfolio'), 'desc' => __('Remove page left/right paddings', 'om_portfolio'), 'id' => 'ompf_portfolio_full_width', 'type' => 'select', 'std' => '', 'options' => array('' => __('No', 'om_portfolio'), '1' => __('Yes', 'om_portfolio'))), 'ompf_portfolio_sort' => array('name' => __('Items order', 'om_portfolio'), 'desc' => __('If custom sort chosen, porfolio items should be sorted on "Portfolio Sort" page', 'om_portfolio'), 'id' => 'ompf_portfolio_sort', 'std' => 'date_desc', 'options' => ompf_get_options_arr('sort'), 'type' => 'select'), 'ompf_portfolio_categories_selector' => array('name' => __('Display categories selector', 'om_portfolio'), 'desc' => '', 'id' => 'ompf_portfolio_categories_selector', 'type' => 'select', 'std' => 'yes', 'options' => array('yes' => __('Yes', 'om_portfolio'), 'no' => __('No', 'om_portfolio'))), 'ompf_portfolio_categories_sort' => array('name' => __('Categories order in selector', 'om_portfolio'), 'desc' => '', 'id' => 'ompf_portfolio_categories_sort', 'std' => 'name', 'options' => array('name' => __('by Name', 'om_portfolio'), 'count' => __('by Count of the posts', 'om_portfolio'), 'slug' => __('by Slug', 'om_portfolio')), 'type' => 'select', 'code' => ' <script> jQuery(function($){ $("#ompf_portfolio_categories_selector").change(function(){ if($(this).val() == "yes") { $("#ompf_portfolio_categories_sort").parents("tr").show(); } else { $("#ompf_portfolio_categories_sort").parents("tr").hide(); } }).change(); }); </script> '), 'ompf_portfolio_pagination' => array('name' => __('Portfolio Pagination', 'om_portfolio'), 'desc' => '', 'id' => 'ompf_portfolio_pagination', 'std' => 'no', 'options' => array('no' => __('No pagination, display all items', 'om_portfolio'), 'pages' => __('Enable pagination', 'om_portfolio'), 'scroll' => __('Infitine scroll (load items on page scroll)', 'om_portfolio')), 'type' => 'select'), 'ompf_portfolio_per_page' => array('name' => __('Number of items per page', 'om_portfolio'), 'desc' => '', 'id' => 'ompf_portfolio_per_page', 'std' => '0', 'type' => 'text', 'code' => ' <script> jQuery(function($){ $("#ompf_portfolio_pagination").change(function(){