function start_el(&$output, $item, $depth = 0, $args = array(), $current_object_id = 0) { $item_output = ''; $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); global $wp_query; $indent = $depth ? str_repeat("\t", $depth) : ''; $this->_load_custom_fields($item); $class_names = $value = ''; $children_number = isset($args->children_number) ? $args->children_number : '0'; $classes = empty($item->classes) ? array() : (array) $item->classes; $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item)); $class_names .= ' menu-item-children-' . $children_number; if ($depth == 1 && $this->_is_custom_item($item)) { $class_names .= ' menu-item-custom-content'; } $class_names = ' class="' . esc_attr($class_names) . '"'; $output .= $indent . '<li id="menu-item-' . $item->ID . '"' . $value . $class_names . '>'; $attributes = !empty($item->attr_title) ? ' title="' . esc_attr($item->attr_title) . '"' : ''; $attributes .= !empty($item->target) ? ' target="' . esc_attr($item->target) . '"' : ''; $attributes .= !empty($item->xfn) ? ' rel="' . esc_attr($item->xfn) . '"' : ''; $attributes .= !empty($item->url) ? ' href="' . esc_attr($item->url) . '"' : ''; $prepend = ''; $append = ''; // $description = ! empty( $item->description ) ? $item->description : ''; $icon = ''; $image = ''; if (!empty($item->description)) { $description = $item->description; if (preg_match('/\\[icon ([a-zA-Z0-9-:]+)\\]/', $description, $matches)) { $icon = do_shortcode('[icon icon_theme="' . $matches[1] . '" color="inherit"]'); } if (preg_match('/\\[background ([a-zA-Z0-9\\-\\_\\/\\:\\~\\.\\s\\%]*\\.(jpg|jpeg|png|gif))\\]/', $description, $matches)) { $image_id = yit_get_attachment_id($matches[1]); list($matches[1], $thumbnail_width, $thumbnail_height) = wp_get_attachment_image_src($image_id, "full"); $image = "<a class='custom-item-{$item->ID} custom-item-yitimage custom-item-image' href='" . esc_attr($item->url) . "'><img src='" . $matches[1] . "' alt='" . apply_filters('the_title', $item->title, $item->ID) . "' width='" . $thumbnail_width . "' height='" . $thumbnail_height . "' /></a>"; } } $item_output = is_object($args) ? $args->before : ''; if ($depth == 1 && $this->_is_custom_item($item)) { $item_output .= '<a' . $attributes . '>' . $icon; $item_output .= $args->link_before . $prepend . apply_filters('the_title', $this->_parse_string($item->title), $item->ID) . $append; $item_output .= $args->link_after; $item_output .= '</a>' . $image; } else { $link_before = is_object($args) ? $args->link_before : ''; $item_output .= '<a' . $attributes . '>' . $icon; $item_output .= $link_before . $prepend . apply_filters('the_title', $this->_parse_string($item->title), $item->ID) . $append; $item_output .= is_object($args) ? $args->link_after : ''; $item_output .= '</a>' . $image; } $item_output .= is_object($args) ? $args->after : ''; $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); }
<?php if ($size == 'small') { $size = 'thumbnail'; } $a_attrs = $img_attrs = $div_attrs = array(); $div_attrs['class'][] = "img_frame img_size_{$size}"; if ($lightbox == 'true' || $lightbox == 'false' && !empty($link)) { $is_link = true; } else { $is_link = false; } $image_id = yit_get_attachment_id($url); if ($image_id != 0) { list($image_url, $image_width, $image_height) = wp_get_attachment_image_src($image_id, $size); if (empty($width)) { $width = $image_width; } if (empty($height)) { $height = $image_height; } $img_attrs['src'] = $image_url; $a_attrs['href'] = $url; } else { $img_attrs['src'] = $a_attrs['href'] = $url; } if (!empty($link) && $lightbox != 'true') { $a_attrs['href'] = $link; } if (!empty($target)) { $a_attrs['target'] = $target;
$slider = YIT_Layout()->slider_name; $static_image = YIT_Layout()->static_image; ?><div class="slider-container"><?php if ( $static_image == 'yes' ) : $image_upload = YIT_Layout()->image_upload; $image_link = YIT_Layout()->image_link; $image_target = YIT_Layout()->image_target; $image_size = yit_getimagesize( $image_upload ); $image_id = yit_get_attachment_id( $image_upload ); list( $thumb_url, $image_width, $image_height ) = wp_get_attachment_image_src( $image_id ); //check if parallax effects is enabled $parallax = YIT_Layout()->parallax; if ( $parallax == 'yes' ): $height = YIT_Layout()->parallax_height; $color = YIT_Layout()->parallax_text_color; $hover_color = YIT_Layout()->parallax_link_color; $valign = YIT_Layout()->parallax_vertical_align; $halign = YIT_Layout()->parallax_horizontal_align; $effect = YIT_Layout()->parallax_effect; $content = YIT_Layout()->parallax_content; $overlay_opacity = YIT_Layout()->parallax_overlay_opacity; $parallax = "[parallax ";
function widget( $args, $instance ) { extract( $args ); $title = apply_filters('widget_title', $instance['title'] ); echo $before_widget; if ( $title ) echo $before_title . $title . $after_title; if( $instance['autop'] ) { $instance['text'] = wpautop( $instance['text'] ); } $text = '<div class="text-image" style="text-align:'. $instance['align'] .'">'; if (isset($instance['image']) && $instance['image'] != '') : if( isset($instance['image_link']) && $instance['image_link'] != '' ) { $text.= '<a href="' . $instance['image_link'] . '">'; } $image_id = yit_get_attachment_id( $instance['image'] ); $image_meta = get_post_meta( $image_id, '_wp_attachment_image_alt', true ); $size = yit_getimagesize($instance['image']); $size = ( !empty($size) && isset($size[3] ) ) ? $size[3] : ''; $text .= '<img src="' . $instance['image'] . '" alt="' . $image_meta . '" '. $size . ' />'; if( isset($instance['image_link']) && $instance['image_link'] != '' ) { $text.= '</a>'; } endif; //string translation fix $clear_text = apply_filters( 'widget_text', yit_wpml_string_translate( 'Widgets', 'widget_text_' . sanitize_title( $instance['text'] ), $instance['text'] ), $instance ); $text .= '</div>' .$clear_text; echo $text; echo $after_widget; }
public function getOutput($item, $fieldId, $field) { if ($field['type'] == 'text') { return "<span class='custom-item-{$item->ID} custom-item-{$fieldId} custom-item-text'>" . $item->{$fieldId} . '</span>'; } elseif ($field['type'] == 'textarea') { return "<p class='custom-item-{$item->ID} custom-item-{$fieldId} custom-item-textarea'>" . $this->_parseString($item->{$fieldId}) . '</p>'; } elseif ($field['type'] == 'upload') { $image_id = yit_get_attachment_id($item->{$fieldId}); list($thumbnail_url, $thumbnail_width, $thumbnail_height) = wp_get_attachment_image_src($image_id, "thumb_portfolio_4cols"); return "<a class='custom-item-{$item->ID} custom-item-{$fieldId} custom-item-image' href='" . esc_attr($item->url) . "'><img src='" . $thumbnail_url . "' alt='" . apply_filters('the_title', $item->title, $item->ID) . "' /></a>"; } }
function start_el(&$output, $item, $depth = 0, $args = array(), $current_object_id = 0) { $item_output = ''; $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); global $wp_query; $indent = $depth ? str_repeat("\t", $depth) : ''; $this->_load_custom_fields($item); $class_names = $value = ''; $children_number = isset($args->children_number) ? $args->children_number : '0'; $classes = empty($item->classes) ? array() : (array) $item->classes; $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item)); $class_names .= ' menu-item-children-' . $children_number; if ($depth == 1 && $this->_is_custom_item($item)) { $class_names .= ' menu-item-custom-content'; } $class_names = ' class="' . esc_attr($class_names) . '"'; $output .= $indent . '<li id="menu-item-' . $item->ID . '"' . $value . $class_names . '>'; $attributes = !empty($item->attr_title) ? ' title="' . esc_attr($item->attr_title) . '"' : ''; $attributes .= !empty($item->target) ? ' target="' . esc_attr($item->target) . '"' : ''; $attributes .= !empty($item->xfn) ? ' rel="' . esc_attr($item->xfn) . '"' : ''; $attributes .= !empty($item->url) ? ' href="' . esc_attr($item->url) . '"' : ''; $prepend = ''; $append = ''; $icon = $image = $tooltip = ''; if (!empty($item->description)) { $description = $item->description; if (preg_match('/\\[icon ([a-zA-Z0-9-:]+)\\]/', $description, $matches)) { $icon = do_shortcode('[icon icon_theme="' . $matches[1] . '" icon_type="theme-icon" circle="no" icon_size="19" color="" ]'); } if (preg_match('/\\[background ([a-zA-Z0-9\\-\\_\\/\\:\\.\\s\\%]*\\.(jpg|jpeg|png|gif))\\]/', $description, $matches)) { $image_id = yit_get_attachment_id($matches[1]); list($matches[1], $thumbnail_width, $thumbnail_height) = wp_get_attachment_image_src($image_id, "full"); $image = "<a class='custom-item-{$item->ID} custom-item-yitimage custom-item-image' href='" . esc_attr($item->url) . "'><img src='" . $matches[1] . "' alt='" . apply_filters('the_title', $item->title, $item->ID) . "' width='" . $thumbnail_width . "' height='" . $thumbnail_height . "' /></a>"; } if (preg_match('/\\[tooltip (["]?[\\w^"]*)(\\s[#]?[0-9a-f]{3,6})?\\]/', $description, $matches)) { $text = isset($matches[1]) ? trim($matches[1], '"') : null; $color = isset($matches[2]) ? trim($matches[2], ' #') : null; if (!empty($text)) { $arrow_color = !empty($color) ? ' style="border-top-color: #' . $color . '"' : ''; $inner_color = !empty($color) ? ' style="background-color: #' . $color . '"' : ''; $tooltip_class = 'tooltip top'; $tooltip_class .= str_word_count($text) == 1 ? ' tooltip-' . strtolower($text) : ''; $tooltip_class = ' class="' . $tooltip_class . '"'; $tooltip = sprintf('<span%s><span class="tooltip-arrow"%s></span><span class="tooltip-inner"%s>%s</span></span>', $tooltip_class, $arrow_color, $inner_color, $text); } } } $item_output = is_object($args) ? $args->before : ''; if ($depth == 1 && $this->_is_custom_item($item)) { $item_output .= '<a' . $attributes . '>' . $icon; $item_output .= $args->link_before . $prepend . apply_filters('the_title', $this->_parse_string($item->title), $item->ID) . $append; $item_output .= $args->link_after; $item_output .= '</a>'; } else { $link_before = is_object($args) ? $args->link_before : ''; $item_output .= '<a' . $attributes . '>' . $icon; $item_output .= $link_before . $prepend . apply_filters('the_title', $this->_parse_string($item->title), $item->ID) . $append; $item_output .= is_object($args) ? $args->link_after : ''; $item_output .= '</a>'; } $item_output .= $tooltip . $image; $item_output .= is_object($args) ? $args->after : ''; $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); }
<?php $title = isset($title) ? $title : ''; $subtitle = isset($subtitle) ? $subtitle : ''; $image = isset($image) ? esc_url($image) : ''; $link = isset($link) ? esc_url($link) : ''; $hover_class = isset($hover_class) ? $hover_class : ''; $slogan_position = isset($slogan_position) ? $slogan_position : ''; if ($image != '') { $attachment_image_id = yit_get_attachment_id($image); $attachment_image_info = yit_image("id={$attachment_image_id}&size=teaser_widget&output=array"); } ?> <?php if ($image != '') { ?> <div class="teaser"> <?php if ($link != '') { ?> <a href="<?php echo $link; ?> "> <?php } else { ?> <?php $hover_class = 'transparent ' . $hover_class; ?>
<?php /** * Your Inspiration Themes * * @package WordPress * @subpackage Your Inspiration Themes * @author Your Inspiration Themes Team <*****@*****.**> * * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://www.gnu.org/licenses/gpl-3.0.txt */ if (yit_get_option('custom-logo') && yit_get_option('logo-url') != '') { $logo_id = yit_get_attachment_id(yit_get_option('logo-url')); $logo_alt = get_post_meta($logo_id, '_wp_attachment_image_alt', true); ?> <a id="logo-img" href="<?php echo home_url(); ?> " title="<?php bloginfo('name'); ?> "> <img src="<?php echo yit_ssl_url(yit_get_option('logo-url')); ?> " title="<?php bloginfo('name'); ?>
public function getOutput($item, $fieldId, $field) { if ($field['type'] == 'text') { return "<span class='custom-item-{$item->ID} custom-item-{$fieldId} custom-item-text'>" . $item->{$fieldId} . '</span>'; } elseif ($field['type'] == 'textarea') { return "<p class='custom-item-{$item->ID} custom-item-{$fieldId} custom-item-textarea'>" . $this->_parseString($item->{$fieldId}) . '</p>'; } elseif ($field['type'] == 'upload') { $image_id = yit_get_attachment_id($item->{$fieldId}); $thumb_size = apply_filters('yit_nav_thumb_size', 'thumb_portfolio_4cols'); $image = yit_image("id=" . $image_id . "&size=" . $thumb_size . "&output=array"); if (count($image) != 3) { return; } list($thumbnail_url, $thumbnail_width, $thumbnail_height) = $image; return "<a class='custom-item-{$item->ID} custom-item-{$fieldId} custom-item-image' href='" . esc_attr($item->url) . "'><img src='" . yit_strip_protocol($thumbnail_url) . "' alt='" . apply_filters('the_title', $item->title, $item->ID) . "' /></a>"; } }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } if ($instance['autop']) { $instance['text'] = wpautop($instance['text']); } $text = '<div class="text-image" style="text-align:' . $instance['align'] . '">'; if (isset($instance['image']) && $instance['image'] != '') { if (isset($instance['image_link']) && $instance['image_link'] != '') { $text .= '<a href="' . $instance['image_link'] . '">'; } $image_id = yit_get_attachment_id($instance['image']); $image_meta = get_post_meta($image_id, '_wp_attachment_image_alt', true); $size = yit_getimagesize($instance['image']); $size = !empty($size) && isset($size[3]) ? $size[3] : ''; $text .= '<img src="' . $instance['image'] . '" alt="' . $image_meta . '" ' . $size . ' />'; if (isset($instance['image_link']) && $instance['image_link'] != '') { $text .= '</a>'; } } $text .= '</div>' . $instance['text']; echo apply_filters('widget_text', $text); echo $after_widget; }
/** * Parse Output * * @param $item * @param $fieldId * @param $field * @return string * * @since 1.0.0 * @author Simone D'Amico <*****@*****.**> */ public function get_output($item, $fieldId, $field) { if ($field['type'] == 'text') { return "<span class='custom-item-{$item->ID} custom-item-{$fieldId} custom-item-text'>" . $item->{$fieldId} . '</span>'; } elseif ($field['type'] == 'textarea') { return "<p class='custom-item-{$item->ID} custom-item-{$fieldId} custom-item-textarea'>" . $this->_parse_string($item->{$fieldId}) . '</p>'; } elseif ($field['type'] == 'select-icon' && $item->{$fieldId} != '') { return do_shortcode('[icon icon_theme="' . $item->{$fieldId} . '" color="inherit"]'); } elseif ($field['type'] == 'text' && $item->{$fieldId} != '') { return "<p class='custom-item-{$item->ID} custom-item-{$fieldId} custom-item-text'>" . $this->_parse_string($item->{$fieldId}) . '</p>'; } elseif ($field['type'] == 'upload') { $image_id = yit_get_attachment_id($item->{$fieldId}); list($thumbnail_url, $thumbnail_width, $thumbnail_height) = wp_get_attachment_image_src($image_id, "full"); return "<a class='custom-item-{$item->ID} custom-item-{$fieldId} custom-item-image' href='" . esc_attr($item->url) . "'><img src='" . $thumbnail_url . "' alt='" . apply_filters('the_title', $item->title, $item->ID) . "' width='" . $thumbnail_width . "' height='" . $thumbnail_height . "' /></a>"; } }
public function getOutput( $item, $fieldId, $field ) { if( $field['type'] == 'text' ) { return "<span class='custom-item-{$item->ID} custom-item-{$fieldId} custom-item-text'>" . $item->{$fieldId} . '</span>'; } elseif( $field['type'] == 'textarea' ) { return "<p class='custom-item-{$item->ID} custom-item-{$fieldId} custom-item-textarea'>" . $this->_parseString($item->{$fieldId}) . '</p>'; } elseif( $field['type'] == 'upload' ) { $image_id = yit_get_attachment_id( $item->{$fieldId} ); $thumb_size = apply_filters( 'yit_nav_thumb_size', 'thumb_portfolio_4cols' ); $image = yit_image( "id=" . $image_id . "&size=" . $thumb_size . "&output=array" ); if ( count( $image ) != 3 ) return; list( $thumbnail_url, $thumbnail_width, $thumbnail_height ) = $image; $img = '<img src="' . yit_strip_protocol( $thumbnail_url ) . '" alt="' . apply_filters( 'the_title', $item->title, $item->ID ) . '" />'; $classes = array( 'custom-item-' . $item->ID, 'custom-item-' . $fieldId, 'custom-item-image' ); $output = '<a class="' . implode(' ', $classes ) . '" href="' . esc_attr( $item->url ) . '">' . $img . '</a>'; return $output; } }