/** * Return PlaceHolder Image * @param string $size * @return string */ function kt_placeholder_callback($size = '') { $placeholder = kt_option('archive_placeholder'); if (is_array($placeholder) && $placeholder['id'] != '') { $obj = kt_get_thumbnail_attachment($placeholder['id'], $size); $imgage = $obj['url']; } elseif ($size == 'kt_grid' || $size == 'kt_masonry') { $imgage = KT_THEME_IMG . 'placeholder-recent.jpg'; } elseif ($size == 'kt_classic') { $imgage = KT_THEME_IMG . 'placeholder-blogpost.jpg'; } elseif ($size == 'kt_list') { $imgage = KT_THEME_IMG . 'placeholder-list.jpg'; } elseif ($size == 'kt_small') { $imgage = KT_THEME_IMG . 'placeholder-small.jpg'; } elseif ($size == 'kt_zigzag') { $imgage = KT_THEME_IMG . 'placeholder-zigzag.jpg'; } else { $imgage = KT_THEME_IMG . 'placeholder-post.jpg'; } return $imgage; }
public function form($instance) { //Defaults $instance = wp_parse_args((array) $instance, array('title' => '', 'target' => '_self', 'link' => '', 'attachment' => '', 'size' => '', 'align' => 'center')); $title = strip_tags($instance['title']); $link = esc_attr($instance['link']); $attachment = esc_attr($instance['attachment']); $preview = false; $img_preview = ""; if ($instance['attachment']) { $file = kt_get_thumbnail_attachment($instance['attachment'], 'full'); $preview = true; $img_preview = $file['url']; } ?> <p><label for="<?php echo $this->get_field_id('title'); ?> "><?php esc_html_e('Title:', 'adroit'); ?> </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> <div class="wrapper_kt_image_upload"> <p style="text-align: center;"> <input type="button" style="width: 100%; padding: 10px; height: auto;" class="button kt_image_upload" value="<?php esc_attr(esc_html_e('Select your image', 'adroit')); ?> " /> <input class="widefat kt_image_attachment" id="<?php echo $this->get_field_id('attachment'); ?> " name="<?php echo $this->get_field_name('attachment'); ?> " type="hidden" value="<?php echo esc_attr($attachment); ?> " /> </p> <p class="kt_image_preview" style="<?php if ($preview) { echo "display: block;"; } ?> "> <img src="<?php echo esc_url($img_preview); ?> " alt="" class="kt_image_preview_img" /> </p> </div> <p style="clear: both;"> <label for="<?php echo $this->get_field_id('link'); ?> "><?php esc_html_e('Link:', 'adroit'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('link'); ?> " name="<?php echo $this->get_field_name('link'); ?> " type="text" value="<?php echo esc_attr($link); ?> " /> </p> <p> <label for="<?php echo $this->get_field_id('target'); ?> "><?php esc_html_e('Target:', 'adroit'); ?> </label> <select name="<?php echo $this->get_field_name('target'); ?> " id="<?php echo $this->get_field_id('target'); ?> " class="widefat"> <option value="_self"<?php selected($instance['target'], '_self'); ?> ><?php esc_html_e('Stay in Window', 'adroit'); ?> </option> <option value="_blank"<?php selected($instance['target'], '_blank'); ?> ><?php esc_html_e('Open New Window', 'adroit'); ?> </option> </select> </p> <p> <?php $sizes = kt_get_image_sizes(); $sizes['full'] = array(); ?> <label for="<?php echo $this->get_field_id('size'); ?> "><?php esc_html_e('Image size:', 'adroit'); ?> </label> <select name="<?php echo $this->get_field_name('size'); ?> " id="<?php echo $this->get_field_id('size'); ?> " class="widefat"> <?php foreach ($sizes as $key => $size) { ?> <?php $option_text = array(); $option_text[] = ucfirst($key); if (isset($size['width'])) { $option_text[] = '(' . $size['width'] . ' x ' . $size['height'] . ')'; } if (isset($size['crop']) && $size['crop']) { $option_text[] = esc_html__('Crop', 'adroit'); } ?> <option value="<?php echo $key; ?> "<?php selected($instance['size'], $key); ?> > <?php echo implode(' - ', $option_text); ?> </option> <?php } ?> </select> </p> <p> <label for="<?php echo $this->get_field_id('align'); ?> "><?php esc_html_e('Align:', 'adroit'); ?> </label> <select name="<?php echo $this->get_field_name('align'); ?> " id="<?php echo $this->get_field_id('align'); ?> " class="widefat"> <option value="center"<?php selected($instance['align'], 'center'); ?> ><?php esc_html_e('Center', 'adroit'); ?> </option> <option value="left"<?php selected($instance['align'], 'left'); ?> ><?php esc_html_e('Left', 'adroit'); ?> </option> <option value="right"<?php selected($instance['align'], 'right'); ?> ><?php esc_html_e('Right', 'adroit'); ?> </option> </select> </p> <?php }
public function form($instance) { //Defaults $instance = wp_parse_args((array) $instance, array('title' => esc_html__('About me', 'adroit'), 'target' => '_self', 'attachment' => '', 'size' => 'kt_recent_posts', 'description' => '')); $title = strip_tags($instance['title']); $attachment = esc_attr($instance['attachment']); $preview = false; $img_preview = ""; if ($instance['attachment']) { $file = kt_get_thumbnail_attachment($instance['attachment'], 'full'); $preview = true; $img_preview = $file['url']; } $value = isset($instance['value']) ? $instance['value'] : ''; ?> <p><label for="<?php echo $this->get_field_id('title'); ?> "><?php esc_html_e('Title:', 'adroit'); ?> </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 esc_attr($title); ?> " /></p> <div class="wrapper_kt_image_upload"> <p style="text-align: center;"> <input type="button" style="width: 100%; padding: 10px; height: auto;" class="button kt_image_upload" value="<?php esc_attr(esc_html_e('Select your image', 'adroit')); ?> " /> <input class="widefat kt_image_attachment" id="<?php echo $this->get_field_id('attachment'); ?> " name="<?php echo $this->get_field_name('attachment'); ?> " type="hidden" value="<?php echo esc_attr($attachment); ?> " /> </p> <p class="kt_image_preview" style="<?php if ($preview) { echo "display: block;"; } ?> "> <img src="<?php echo esc_url($img_preview); ?> " alt="" class="kt_image_preview_img" /> </p> </div> <p style="clear: both;"> <?php $sizes = kt_get_image_sizes(); $sizes['full'] = array(); ?> <label for="<?php echo $this->get_field_id('size'); ?> "><?php esc_html_e('Image size:', 'adroit'); ?> </label> <select name="<?php echo $this->get_field_name('size'); ?> " id="<?php echo $this->get_field_id('size'); ?> " class="widefat"> <?php foreach ($sizes as $key => $size) { ?> <?php $option_text = array(); $option_text[] = ucfirst($key); if (isset($size['width'])) { $option_text[] = '(' . $size['width'] . ' x ' . $size['height'] . ')'; } if (isset($size['crop']) && $size['crop']) { $option_text[] = esc_html__('Crop', 'adroit'); } ?> <option value="<?php echo esc_attr($key); ?> "<?php selected($instance['size'], $key); ?> > <?php echo implode(' - ', $option_text); ?> </option> <?php } ?> </select> </p> <p> <label for="<?php echo $this->get_field_id('description'); ?> "><?php esc_html_e('Description:', 'adroit'); ?> </label> <textarea class="widefat" rows="5" cols="20" id="<?php echo $this->get_field_id('description'); ?> " name="<?php echo $this->get_field_name('description'); ?> "><?php echo esc_textarea($instance['description']); ?> </textarea></p> <?php $socials = array('facebook' => 'fa fa-facebook', 'twitter' => 'fa fa-twitter', 'pinterest' => 'fa fa-pinterest-p', 'dribbble' => 'fa fa-dribbble', 'vimeo' => 'fa fa-vimeo-square', 'tumblr' => 'fa fa-tumblr', 'skype' => 'fa fa-skype', 'linkedin' => 'fa fa-linkedin', 'googleplus' => 'fa fa-google-plus', 'youtube' => 'fa fa-youtube-play', 'instagram' => 'fa fa-instagram'); $arr_val = $value ? explode(',', $value) : array(); ?> <div class="kt-socials-options"> <ul class="kt-socials-lists clearfix"> <?php foreach ($socials as $key => $social) { ?> <?php $class = in_array($key, $arr_val) ? 'selected' : ''; ?> <li data-type="<?php echo esc_attr($key); ?> " class="<?php echo $class; ?> "><i class="<?php echo esc_attr($social); ?> "></i><span></span></li> <?php } ?> </ul><!-- .kt-socials-lists --> <ul class="kt-socials-profiles clearfix"> <?php if (count($arr_val)) { foreach ($arr_val as $item) { ?> <li data-type="<?php echo esc_attr($item); ?> "><i class="<?php echo esc_attr($socials[$item]); ?> "></i><span></span></li> <?php } } ?> </ul><!-- .kt-socials-profiles --> <input id="<?php echo $this->get_field_id('value'); ?> " type="hidden" class="wpb_vc_param_value kt-socials-value" name="<?php echo $this->get_field_name('value'); ?> " value="<?php echo esc_attr($value); ?> " /> </div><!-- .kt-socials-options --> <?php wp_enqueue_script('cosials_js', KT_FW_JS . 'kt_socials.js', array('jquery'), KT_FW_VER, true); ?> <script type="text/javascript"> (function($){ $('document').ready(function() { $( ".kt-socials-profiles" ).sortable({ placeholder: "ui-socials-highlight", update: function( event, ui ) { var $parrent_ui = ui.item.closest('.kt-socials-options'), $profiles_ui = $parrent_ui.find('.kt-socials-profiles'), $value_ui = $parrent_ui.find('.kt-socials-value'); $profiles_val_ui = []; $profiles_ui.find('li').each(function(){ $profiles_val_ui.push($(this).data('type')); }); $value_ui.val($profiles_val_ui.join()); } }); }); })(jQuery); </script> <?php }
public function form($instance) { //Defaults $instance = wp_parse_args((array) $instance, array('title' => esc_html__('Advertise', 'adroit'), 'target' => '_self', 'link1' => '', 'attachment1' => '', 'link2' => '', 'attachment2' => '', 'link3' => '', 'attachment3' => '', 'link4' => '', 'attachment4' => '')); $title = strip_tags($instance['title']); $preview1 = $preview2 = $preview3 = $preview4 = false; $img_preview1 = $img_preview2 = $img_preview3 = $img_preview4 = ""; $link1 = esc_attr($instance['link1']); $attachment1 = esc_attr($instance['attachment1']); if ($instance['attachment1']) { $file1 = kt_get_thumbnail_attachment($instance['attachment1'], 'kt_small'); $preview1 = true; $img_preview1 = $file1['url']; } $link2 = esc_attr($instance['link2']); $attachment2 = esc_attr($instance['attachment2']); if ($instance['attachment2']) { $file2 = kt_get_thumbnail_attachment($instance['attachment2'], 'kt_small'); $preview2 = true; $img_preview2 = $file2['url']; } $link3 = esc_attr($instance['link3']); $attachment3 = esc_attr($instance['attachment3']); if ($instance['attachment3']) { $file3 = kt_get_thumbnail_attachment($instance['attachment3'], 'kt_small'); $preview3 = true; $img_preview3 = $file3['url']; } $link4 = esc_attr($instance['link4']); $attachment4 = esc_attr($instance['attachment4']); if ($instance['attachment4']) { $file4 = kt_get_thumbnail_attachment($instance['attachment4'], 'kt_small'); $preview4 = true; $img_preview4 = $file4['url']; } ?> <p><label for="<?php echo $this->get_field_id('title'); ?> "><?php esc_html_e('Title:', 'adroit'); ?> </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> <h4><?php esc_html_e('Image 1', 'adroit'); ?> </h4> <div class="wrapper_kt_image_upload"> <p style="text-align: center;"> <input type="button" style="width: 100%; padding: 10px; height: auto;" class="button kt_image_upload" value="<?php esc_attr(esc_html_e('Select your image 1', 'adroit')); ?> " /> <input class="widefat kt_image_attachment" id="<?php echo $this->get_field_id('attachment1'); ?> " name="<?php echo $this->get_field_name('attachment1'); ?> " type="hidden" value="<?php echo esc_attr($attachment1); ?> " /> </p> <p class="kt_image_preview" style="<?php if ($preview1) { echo "display: block;"; } ?> "> <img src="<?php echo esc_url($img_preview1); ?> " alt="" class="kt_image_preview_img" /> </p> </div> <p style="clear: both;"> <label for="<?php echo $this->get_field_id('link1'); ?> "><?php esc_html_e('Link Ads 1:', 'adroit'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('link1'); ?> " name="<?php echo $this->get_field_name('link1'); ?> " type="text" value="<?php echo esc_attr($link1); ?> " /> </p> <h4><?php esc_html_e('Image 2', 'adroit'); ?> </h4> <div class="wrapper_kt_image_upload"> <p style="text-align: center;"> <input type="button" style="width: 100%; padding: 10px; height: auto;" class="button kt_image_upload" value="<?php esc_attr(esc_html_e('Select your image 2', 'adroit')); ?> " /> <input class="widefat kt_image_attachment" id="<?php echo $this->get_field_id('attachment2'); ?> " name="<?php echo $this->get_field_name('attachment2'); ?> " type="hidden" value="<?php echo esc_attr($attachment2); ?> " /> </p> <p class="kt_image_preview" style="<?php if ($preview2) { echo "display: block;"; } ?> "> <img src="<?php echo esc_url($img_preview2); ?> " alt="" class="kt_image_preview_img" /> </p> </div> <p style="clear: both;"> <label for="<?php echo $this->get_field_id('link2'); ?> "><?php esc_html_e('Link Ads 2:', 'adroit'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('link2'); ?> " name="<?php echo $this->get_field_name('link2'); ?> " type="text" value="<?php echo esc_attr($link2); ?> " /> </p> <h4><?php esc_html_e('Image 3', 'adroit'); ?> </h4> <div class="wrapper_kt_image_upload"> <p style="text-align: center;"> <input type="button" style="width: 100%; padding: 10px; height: auto;" class="button kt_image_upload" value="<?php esc_attr(esc_html_e('Select your image 3', 'adroit')); ?> " /> <input class="widefat kt_image_attachment" id="<?php echo $this->get_field_id('attachment3'); ?> " name="<?php echo $this->get_field_name('attachment3'); ?> " type="hidden" value="<?php echo esc_attr($attachment3); ?> " /> </p> <p class="kt_image_preview" style="<?php if ($preview3) { echo "display: block;"; } ?> "> <img src="<?php echo esc_url($img_preview3); ?> " alt="" class="kt_image_preview_img" /> </p> </div> <p style="clear: both;"> <label for="<?php echo $this->get_field_id('link3'); ?> "><?php esc_html_e('Link Ads 3:', 'adroit'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('link3'); ?> " name="<?php echo $this->get_field_name('link3'); ?> " type="text" value="<?php echo esc_attr($link3); ?> " /> </p> <h4><?php esc_html_e('Image 4', 'adroit'); ?> </h4> <div class="wrapper_kt_image_upload"> <p style="text-align: center;"> <input type="button" style="width: 100%; padding: 10px; height: auto;" class="button kt_image_upload" value="<?php esc_attr(esc_html_e('Select your image 4', 'adroit')); ?> " /> <input class="widefat kt_image_attachment" id="<?php echo $this->get_field_id('attachment4'); ?> " name="<?php echo $this->get_field_name('attachment4'); ?> " type="hidden" value="<?php echo esc_attr($attachment4); ?> " /> </p> <p class="kt_image_preview" style="<?php if ($preview4) { echo "display: block;"; } ?> "> <img src="<?php echo esc_url($img_preview4); ?> " alt="" class="kt_image_preview_img" /> </p> </div> <p style="clear: both;"> <label for="<?php echo $this->get_field_id('link4'); ?> "><?php esc_html_e('Link Ads 4:', 'adroit'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('link4'); ?> " name="<?php echo $this->get_field_name('link4'); ?> " type="text" value="<?php echo esc_attr($link4); ?> " /> </p> <hr /> <p> <label for="<?php echo $this->get_field_id('target'); ?> "><?php esc_html_e('Target:', 'adroit'); ?> </label> <select name="<?php echo $this->get_field_name('target'); ?> " id="<?php echo $this->get_field_id('target'); ?> " class="widefat"> <option value="_self"<?php selected($instance['target'], '_self'); ?> ><?php esc_html_e('Stay in Window', 'adroit'); ?> </option> <option value="_blank"<?php selected($instance['target'], '_blank'); ?> ><?php esc_html_e('Open New Window', 'adroit'); ?> </option> </select> </p> <?php }
public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { if ($depth === 0) { $this->megamenu_enable = get_post_meta($item->ID, '_menu_item_megamenu_enable', true); $this->megamenu_width = get_post_meta($item->ID, '_menu_item_megamenu_width', true); $this->megamenu_columns = get_post_meta($item->ID, '_menu_item_megamenu_columns', true); $this->megamenu_position = get_post_meta($item->ID, '_menu_item_megamenu_position', true); $this->megamenu_layout = get_post_meta($item->ID, '_menu_item_megamenu_layout', true); } $indent = $depth ? str_repeat("\t", $depth) : ''; $classes = empty($item->classes) ? array() : (array) $item->classes; $classes[] = 'menu-item-' . $item->ID; $classes[] = 'menu-item-level-' . $depth; $classes[] = 'kt-menu-item'; if ($depth === 0 && $this->megamenu_enable) { $classes[] = 'kt-megamenu-item'; $classes[] = 'kt-megamenu-item-' . $this->megamenu_width; } $endrow = get_post_meta($item->ID, '_menu_item_megamenu_endrow', true); if ($depth == 1 && $endrow) { $classes[] = 'kt-megamenu-item-endrow'; } /** * Filter the CSS class(es) applied to a menu item's <li>. * * @since 3.0.0 * * @see wp_nav_menu() * * @param array $classes The CSS classes that are applied to the menu item's <li>. * @param object $item The current menu item. * @param array $args An array of wp_nav_menu() arguments. */ $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args)); $class_names = $class_names ? ' class="' . esc_attr($class_names) . '"' : ''; /** * Filter the ID applied to a menu item's <li>. * * @since 3.0.1 * * @see wp_nav_menu() * * @param string $menu_id The ID that is applied to the menu item's <li>. * @param object $item The current menu item. * @param array $args An array of wp_nav_menu() arguments. */ $id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args); $id = $id ? ' id="' . esc_attr($id) . '"' : ''; $style = ''; $clwidth = get_post_meta($item->ID, '_menu_item_megamenu_clwidth', true); if ($depth == 1 && $clwidth) { $style = 'width: ' . $clwidth; } $output .= $indent . '<li' . $id . $class_names . ' style="' . $style . '">'; $atts = array(); $atts['title'] = !empty($item->attr_title) ? $item->attr_title : ''; $atts['target'] = !empty($item->target) ? $item->target : ''; $atts['rel'] = !empty($item->xfn) ? $item->xfn : ''; $atts['href'] = !empty($item->url) ? $item->url : ''; $atts['class'] = 'kt-megamenu-link'; /** * Filter the HTML attributes applied to a menu item's <a>. * * @since 3.6.0 * * @see wp_nav_menu() * * @param array $atts { * The HTML attributes applied to the menu item's <a>, empty strings are ignored. * * @type string $title Title attribute. * @type string $target Target attribute. * @type string $rel The rel attribute. * @type string $href The href attribute. * } * @param object $item The current menu item. * @param array $args An array of wp_nav_menu() arguments. */ $atts = apply_filters('nav_menu_link_attributes', $atts, $item, $args); $attributes = ''; foreach ($atts as $attr => $value) { if (!empty($value)) { $value = 'href' === $attr ? esc_url($value) : esc_attr($value); $attributes .= ' ' . $attr . '="' . $value . '"'; } } if (is_array($args)) { $args = (object) $args; } $item_output = ''; $item_output .= $args->before; $megamenu_columnlink = $this->megamenu_enable && $depth == 1 ? get_post_meta($item->ID, '_menu_item_megamenu_columnlink', true) : false; if (!$megamenu_columnlink || $depth != 1) { $item_output .= '<a' . $attributes . '>'; } else { $item_output .= '<span class="megamenu-title">'; } if ($this->megamenu_enable && $depth == 1) { $image = get_post_meta($item->ID, '_menu_item_megamenu_image', true); if ($image) { $file = kt_get_thumbnail_attachment($image, 'full'); if ($file['src']) { $item_output .= sprintf('<img src="%s" alt="%s" title="%s" class="img-responsive"/>', $file['src'], $file['alt'], $file['title']); } } } $icon = get_post_meta($item->ID, '_menu_item_megamenu_icon', true); $icon = $icon ? '<i class="icon-menu ' . $icon . '"></i>' : ''; /** This filter is documented in wp-includes/post-template.php */ $item_output .= $args->link_before . $icon . apply_filters('the_title', $item->title, $item->ID) . $args->link_after; if (!$megamenu_columnlink || !($depth = 1)) { $item_output .= '</a>'; } else { $item_output .= '</span>'; } $item_output .= $args->after; if ($depth === 0 && $this->megamenu_enable == "enabled") { $colums = $this->megamenu_columns ? $this->megamenu_columns : 'auto'; $position = $this->megamenu_width != 'full' ? ' megamenu-position-' . $this->megamenu_position : ''; $layout = ' megamenu-layout-' . $this->megamenu_layout; $item_output .= "\n{$indent}<div class=\"kt-megamenu-wrapper {$position} {$layout} megamenu-columns-{$colums} \">\n<div class=\"container\">\n"; if ($depth == 0 && $item->object == 'category') { $item_output .= '<div class="megamenu-posts">'; global $post; $menu_posts = get_posts(apply_filters('kt_megamenu_posts', array('posts_per_page' => 3, 'category' => $item->object_id))); ob_start(); foreach ($menu_posts as $post) { ?> <div class="col-lg-4 col-md-4"> <?php get_template_part('templates/blog/grid/contento', get_post_format()); ?> </div> <?php } wp_reset_postdata(); $item_output .= sprintf('<div class="blog-posts-menu"><div class="row">%s</div></div>', ob_get_clean()); $item_output .= sprintf('<a href="%s">%s</a>', get_category_link($item->object_id), __('See all', 'adroit')); $item_output .= '</div>'; } } $megamenu_columntitle = get_post_meta($item->ID, '_menu_item_megamenu_columntitle', true); if ($megamenu_columntitle && $depth == 1) { $item_output = ''; } $megamenu_widget = $this->megamenu_enable && $depth == 1 ? get_post_meta($item->ID, '_menu_item_megamenu_widget', true) : false; if ($megamenu_widget && $depth == 1) { ob_start(); dynamic_sidebar($megamenu_widget); $item_output .= '<div class="kt-megamenu-widget">' . ob_get_contents() . '</div>'; ob_end_clean(); } /** * Filter a menu item's starting output. * * The menu item's starting output only includes $args->before, the opening <a>, * the menu item's title, the closing </a>, and $args->after. Currently, there is * no filter for modifying the opening and closing <li> for a menu item. * * @since 3.0.0 * * @see wp_nav_menu() * * @param string $item_output The menu item's starting HTML output. * @param object $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @param array $args An array of wp_nav_menu() arguments. */ $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); }
/** * Return PlaceHolder Image * @param string $size * @return string */ function kt_placeholder_callback($size = '') { $placeholder = kt_option('archive_placeholder'); if (is_array($placeholder) && $placeholder['id'] != '') { $obj = kt_get_thumbnail_attachment($placeholder['id'], $size); $imgage = $obj['url']; } elseif ($size == 'kt_recent_posts' || $size == 'kt_recent_posts_masonry') { $imgage = KT_THEME_IMG . 'placeholder-recent.jpg'; } elseif ($size == 'kt_blog_post' || $size == 'kt_blog_post_sidebar') { $imgage = KT_THEME_IMG . 'placeholder-blogpost.jpg'; } elseif ($size == 'kt_blog_post_slider') { $imgage = KT_THEME_IMG . 'placeholder-slider.jpg'; } else { $imgage = KT_THEME_IMG . 'placeholder-post.jpg'; } return $imgage; }
function kt_add_custom_fields($item_id, $item, $depth, $args) { ?> <div class="clearfix"></div> <div class="container-megamenu"> <p class="field-icon description description-wide clearfix"> <label for="menu-item-icon-<?php echo $item_id; ?> "> <?php _e('Select icon of this item (set empty to hide). Ex: fa fa-home', 'adroit'); ?> <br /> <input type="text" id="edit-menu-item-icon-<?php echo $item_id; ?> " class="widefat edit-menu-item-icon" name="menu-item-megamenu-icon[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->icon); ?> " /> </label> </p> <div class="wrapper-megamenu"> <p class="field-enable description description-wide"> <label for="menu-item-enable-<?php echo $item_id; ?> "> <input type="checkbox" <?php checked($item->enable, 'enabled'); ?> data-id="<?php echo $item_id; ?> " id="menu-item-enable-<?php echo $item_id; ?> " name="menu-item-megamenu-enable[<?php echo $item_id; ?> ]" value="enabled" class="edit-menu-item-enable"/> <b><?php _e('Enable Mega Menu (only for main menu)', 'adroit'); ?> </b> </label> </p> <div id="content-megamenu-<?php echo $item_id; ?> " class="megamenu-layout clearfix"> <div class="megamenu-layout-depth-0"> <p class="field-columns description description-wide"> <label for="menu-item-columns-<?php echo $item_id; ?> "> <?php _e('Mega Menu number of columns', 'adroit'); ?> <br /> <select id="menu-item-columns-<?php echo $item_id; ?> " name="menu-item-megamenu-columns[<?php echo $item_id; ?> ]" class="widefat edit-menu-item-columns"> <?php for ($i = 4; $i > 1; $i--) { ?> <option <?php selected($item->columns, $i); ?> value="<?php echo $i; ?> "><?php echo $i; ?> </option> <?php } ?> </select> </label> </p> <p class="field-layout description description-wide"> <label for="menu-item-layout-<?php echo $item_id; ?> "> <?php _e('Mega Menu layout', 'adroit'); ?> <br /> <select id="menu-item-layout-<?php echo $item_id; ?> " name="menu-item-megamenu-layout[<?php echo $item_id; ?> ]" class="widefat edit-menu-item-layout"> <option <?php selected($item->layout, 'default'); ?> value="default"><?php _e('Default', 'adroit'); ?> </option> <option <?php selected($item->layout, 'table'); ?> value="table"><?php _e('Table + Border', 'adroit'); ?> </option> </select> </label> </p> <p class="field-width description description-wide"> <label for="menu-item-width-<?php echo $item_id; ?> "> <?php _e('Mega Menu width', 'adroit'); ?> <br /> <select id="menu-item-width-<?php echo $item_id; ?> " name="menu-item-megamenu-width[<?php echo $item_id; ?> ]" class="widefat edit-menu-item-width"> <option <?php selected($item->width, 'full'); ?> value="full"><?php _e('Full Width', 'adroit'); ?> </option> <option <?php selected($item->width, 'half'); ?> value="half"><?php _e('1/2', 'adroit'); ?> </option> <option <?php selected($item->width, 'three'); ?> value="three"><?php _e('3/4', 'adroit'); ?> </option> <option <?php selected($item->width, 'four'); ?> value="four"><?php _e('4/5', 'adroit'); ?> </option> <option <?php selected($item->width, 'five'); ?> value="five"><?php _e('9/10', 'adroit'); ?> </option> </select> </label> </p> <p class="description description-position description-wide"> <label> <?php _e('Mega menu position', 'adroit'); ?> <br /> <select id="menu-item-position-<?php echo $item_id; ?> " name="menu-item-megamenu-position[<?php echo $item_id; ?> ]" class="widefat edit-menu-item-position"> <option <?php selected($item->position, 'center'); ?> value="center">Center</option> <option <?php selected($item->position, 'left-menubar'); ?> value=""><?php _e('Left edge of menu bar', 'adroit'); ?> </option> <option <?php selected($item->position, 'right-menubar'); ?> value="right-menubar"><?php _e('Right edge of menu bar', 'adroit'); ?> </option> <option <?php selected($item->position, 'left-parent'); ?> value="left-parent"><?php _e('Left Edge of Parent item', 'adroit'); ?> </option> <option <?php selected($item->position, 'right-parent'); ?> value="right-parent"><?php _e('Right Edge of Parent item', 'adroit'); ?> </option> </select> </label> </p> </div> <div class="megamenu-layout-depth-1"> <p class="field-image description description-wide"> <?php $preview = false; $img_preview = ""; if ($item->image) { $file = kt_get_thumbnail_attachment($item->image, 'full'); $preview = true; $img_preview = $file['src']; } ?> <label for="menu-item-image-<?php echo $item_id; ?> "> <?php _e('Menu image', 'adroit'); ?> <br /> <input type="hidden" value="<?php echo esc_attr($item->image); ?> " name="menu-item-megamenu-image[<?php echo $item_id; ?> ]" id="menu-item-image-<?php echo $item_id; ?> " class="widefat edit-menu-item-image" /> </label> <span class="clearfix"></span> <span class="kt_image_preview" style="<?php if ($preview) { echo "display: block;"; } ?> "> <img src="<?php echo esc_url($img_preview); ?> " alt="" title="" /> <i class="fa fa-times"></i> </span> <span class="clearfix"></span> <input type="button" class="button-secondary kt_image_menu" value="<?php _e('Upload image', 'adroit'); ?> " style="width: 100%;" /> </p> <p class="field-clwidth description description-wide"> <label for="menu-item-clwidth-<?php echo $item_id; ?> "> <?php _e('Mega Menu Column Width - Overrides parent colum (in percentage, ex: 30%)', 'adroit'); ?> <br /> <input type="text" value="<?php echo esc_attr($item->clwidth); ?> " id="menu-item-clwidth-<?php echo $item_id; ?> " name="menu-item-megamenu-clwidth[<?php echo $item_id; ?> ]" class="widefat edit-menu-item-clwidth"/> </label> </p> <p class="field-columntitle description description-wide"> <label for="menu-item-columntitle-<?php echo $item_id; ?> "> <input type="checkbox" <?php checked($item->columntitle, 'enabled'); ?> id="menu-item-columntitle-<?php echo $item_id; ?> " name="menu-item-megamenu-columntitle[<?php echo $item_id; ?> ]" value="enabled"/> <?php _e('Disable Mega Menu Column Title', 'adroit'); ?> </label> </p> <p class="field-columnlink description description-wide"> <label for="menu-item-columnlink-<?php echo $item_id; ?> "> <input type="checkbox" <?php checked($item->columnlink, 'enabled'); ?> id="menu-item-columnlink-<?php echo $item_id; ?> " name="menu-item-megamenu-columnlink[<?php echo $item_id; ?> ]" value="enabled"/> <?php _e('Disable Mega Menu Column Link', 'adroit'); ?> </label> </p> <p class="field-endrow description description-wide"> <label for="menu-item-endrow-<?php echo $item_id; ?> "> <input type="checkbox" <?php checked($item->endrow, 'enabled'); ?> id="menu-item-endrow-<?php echo $item_id; ?> " name="menu-item-megamenu-endrow[<?php echo $item_id; ?> ]" value="enabled" class="edit-menu-item-endrow"/> <?php _e('End Row (Clear the next row and start a new one with next item)', 'adroit'); ?> </label> </p> <p class="field-widget description description-wide"> <label for="menu-item-widget-<?php echo $item_id; ?> "> <?php _e('Mega Menu Widget Area', 'adroit'); ?> <br /> <?php $sidebars = kt_sidebars(); ?> <select id="menu-item-widget-<?php echo $item_id; ?> " name="menu-item-megamenu-widget[<?php echo $item_id; ?> ]" class="widefat edit-menu-item-widget"> <option value="0"><?php _e('Select Widget Area', 'adroit'); ?> </option> <?php foreach ($sidebars as $k => $v) { ?> <option <?php selected($item->widget, $k); ?> value="<?php echo $k; ?> "><?php echo $v; ?> </option> <?php } ?> </select> </label> </p> </div> </div><!-- #content-megamenu-<?php echo $item_id; ?> --> </div><!-- .wrapper-megamenu --> </div><!-- .container-megamenu --> <?php }