/** * Renders the content for a builder layout while in the loop. * This method should only be called by the_content filter as * defined in fl-builder.php. To output builder content, use * the_content function while in a WordPress loop. * * @since 1.0 * @param string $content The existing content. * @return string */ public static function render_content($content) { $post_id = FLBuilderModel::get_post_id(); $enabled = FLBuilderModel::is_builder_enabled(); $rendering = $post_id === self::$post_rendering; $ajax = defined('DOING_AJAX'); $in_loop = in_the_loop(); $is_global = in_array($post_id, FLBuilderModel::get_global_posts()); if ($enabled && !$rendering && !$ajax && ($in_loop || $is_global)) { // Set the post rendering ID. self::$post_rendering = $post_id; // Remove the builder's render_content filter so it's not called again. remove_filter('the_content', 'FLBuilder::render_content'); // Render the content. ob_start(); echo '<div class="' . self::render_content_classes() . '" data-post-id="' . $post_id . '">'; self::render_nodes(); echo '</div>'; $content = ob_get_clean(); // Reapply the builder's render_content filter. add_filter('the_content', 'FLBuilder::render_content'); // Do shortcodes here since letting the WP filter run can cause an infinite loop. $pattern = get_shortcode_regex(); $content = preg_replace_callback("/{$pattern}/s", 'FLBuilder::double_escape_shortcodes', $content); $content = do_shortcode($content); // Add srcset attrs to images with the class wp-image-<ID>. if (function_exists('wp_make_content_images_responsive')) { $content = wp_make_content_images_responsive($content); } // Clear the post rendering ID. self::$post_rendering = null; } return $content; }
public function get_template_variables($instance, $args) { $instance = wp_parse_args($instance, array('text' => '')); $instance['text'] = $this->unwpautop($instance['text']); $instance['text'] = apply_filters('widget_text', $instance['text']); // Run some known stuff if (!empty($GLOBALS['wp_embed'])) { $instance['text'] = $GLOBALS['wp_embed']->autoembed($instance['text']); } if (function_exists('wp_make_content_images_responsive')) { $instance['text'] = wp_make_content_images_responsive($instance['text']); } if ($instance['autop']) { $instance['text'] = wpautop($instance['text']); } $instance['text'] = do_shortcode(shortcode_unautop($instance['text'])); return array('text' => $instance['text']); }
/** * @ticket 33641 */ function test_wp_make_content_images_responsive_with_preexisting_srcset() { // Generate HTML and add a dummy srcset attribute. $image_html = get_image_tag(self::$large_id, '', '', '', 'medium'); $image_html = preg_replace('|<img ([^>]+) />|', '<img $1 ' . 'srcset="image2x.jpg 2x" />', $image_html); // The content filter should return the image unchanged. $this->assertSame($image_html, wp_make_content_images_responsive($image_html)); }
function before_the_title() { $post = get_post(); if (isset($post->post_title_img)) { echo wp_make_content_images_responsive($post->post_title_img); } }
/** * prepare the ads frontend output * * @param obj $ad ad object * @return str $content ad content prepared for frontend output * @since 1.0.0 */ public function prepare_output($ad) { // apply functions normally running through the_content filter // the_content filter is not used here because it created an infinite loop (ads within ads for "before content" and other auto injections) // maybe the danger is not here yet, but changing it to use the_content filter changes a lot $output = $ad->content; $output = wptexturize($output); $output = convert_smilies($output); $output = convert_chars($output); $output = wpautop($output); $output = shortcode_unautop($output); $output = do_shortcode($output); $output = prepend_attachment($output); // make included images responsive, since WordPress 4.4 if (!defined('ADVADS_DISABLE_RESPONSIVE_IMAGES') && function_exists('wp_make_content_images_responsive')) { $output = wp_make_content_images_responsive($output); } return $output; }
function test_wp_make_content_images_responsive_schemes() { $image_meta = wp_get_attachment_metadata(self::$large_id); $size_array = array((int) $image_meta['sizes']['medium']['width'], (int) $image_meta['sizes']['medium']['height']); $srcset = sprintf('srcset="%s"', wp_get_attachment_image_srcset(self::$large_id, $size_array, $image_meta)); $sizes = sprintf('sizes="%s"', wp_get_attachment_image_sizes(self::$large_id, $size_array, $image_meta)); // Build HTML for the editor. $img = get_image_tag(self::$large_id, '', '', '', 'medium'); $img_https = str_replace('http://', 'https://', $img); $img_relative = str_replace('http://', '//', $img); // Manually add srcset and sizes to the markup from get_image_tag(); $respimg = preg_replace('|<img ([^>]+) />|', '<img $1 ' . $srcset . ' ' . $sizes . ' />', $img); $respimg_https = preg_replace('|<img ([^>]+) />|', '<img $1 ' . $srcset . ' ' . $sizes . ' />', $img_https); $respimg_relative = preg_replace('|<img ([^>]+) />|', '<img $1 ' . $srcset . ' ' . $sizes . ' />', $img_relative); $content = ' <p>Image, http: protocol. Should have srcset and sizes.</p> %1$s <p>Image, http: protocol. Should have srcset and sizes.</p> %2$s <p>Image, protocol-relative. Should have srcset and sizes.</p> %3$s'; $unfiltered = sprintf($content, $img, $img_https, $img_relative); $expected = sprintf($content, $respimg, $respimg_https, $respimg_relative); $actual = wp_make_content_images_responsive($unfiltered); $this->assertSame($expected, $actual); }
/** * Echo the post image on archive pages. * * If this an archive page and the option is set to show thumbnail, then it gets the image size as per the theme * setting, wraps it in the post permalink and echoes it. * * @since 1.1.0 */ function genesis_do_post_image() { if (!is_singular() && genesis_get_option('content_archive_thumbnail')) { $img = genesis_get_image(array('format' => 'html', 'size' => genesis_get_option('image_size'), 'context' => 'archive', 'attr' => genesis_parse_attr('entry-image', array('alt' => get_the_title())))); if (!empty($img)) { genesis_markup(array('open' => '<a %s>', 'close' => '</a>', 'content' => wp_make_content_images_responsive($img), 'context' => 'entry-image-link')); } } }
<?php $attachment_data = wp_get_attachment_metadata($attachment_id); ?> <?php if (is_array($attachment_data)) { ?> <li> <div class="fusion-image-wrapper"> <a href="<?php the_permalink(); ?> "> <?php $image_markup = sprintf('<img src="%s" alt="%s" class="wp-image-%s" role="presentation"/>', $attachment_image[0], $attachment_data['image_meta']['title'], $attachment_id); $image_markup = Avada()->images->edit_grid_image_src($image_markup, get_the_ID(), $attachment_id, $size); echo wp_make_content_images_responsive($image_markup); ?> </a> <a style="display:none;" href="<?php echo $full_image[0]; ?> " data-rel="iLightbox[gallery<?php echo $post->ID; ?> ]" title="<?php echo get_post_field('post_excerpt', $attachment_id); ?> " data-title="<?php echo get_post_field('post_title', $attachment_id); ?> " data-caption="<?php
/** * Filter to add 'srcset' and 'sizes' attributes to images in the post content. * * @since 2.5.0 * @deprecated 3.0.0 Use 'wp_make_content_images_responsive()' * * @see wp_make_content_images_responsive() * * @param string $content The raw post content to be filtered. * @return string Converted content with 'srcset' and 'sizes' added to images. */ function tevkori_filter_content_images($content) { _deprecated_function(__FUNCTION__, '3.0.0', 'wp_make_content_images_responsive()'); return wp_make_content_images_responsive($content); }
/** * Echo the widget content. * * @since 0.1.8 * * @global WP_Query $wp_query Query object. * @global array $_genesis_displayed_ids Array of displayed post IDs. * @global int $more * * @param array $args Display arguments including `before_title`, `after_title`, * `before_widget`, and `after_widget`. * @param array $instance The settings for the particular instance of the widget. */ function widget($args, $instance) { global $wp_query, $_genesis_displayed_ids; // Merge with defaults. $instance = wp_parse_args((array) $instance, $this->defaults); echo $args['before_widget']; // Set up the author bio. if (!empty($instance['title'])) { echo $args['before_title'] . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $args['after_title']; } $query_args = array('post_type' => 'post', 'cat' => $instance['posts_cat'], 'showposts' => $instance['posts_num'], 'offset' => $instance['posts_offset'], 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'ignore_sticky_posts' => $instance['exclude_sticky']); // Exclude displayed IDs from this loop? if ($instance['exclude_displayed']) { $query_args['post__not_in'] = (array) $_genesis_displayed_ids; } $wp_query = new WP_Query($query_args); if (have_posts()) { while (have_posts()) { the_post(); $_genesis_displayed_ids[] = get_the_ID(); genesis_markup(array('open' => '<article %s>', 'context' => 'entry')); $image = genesis_get_image(array('format' => 'html', 'size' => $instance['image_size'], 'context' => 'featured-post-widget', 'attr' => genesis_parse_attr('entry-image-widget', array('alt' => get_the_title())))); if ($instance['show_image'] && $image) { $role = empty($instance['show_title']) ? '' : 'aria-hidden="true"'; printf('<a href="%s" class="%s" %s>%s</a>', get_permalink(), esc_attr($instance['image_alignment']), $role, wp_make_content_images_responsive($image)); } if (!empty($instance['show_gravatar'])) { echo '<span class="' . esc_attr($instance['gravatar_alignment']) . '">'; echo get_avatar(get_the_author_meta('ID'), $instance['gravatar_size']); echo '</span>'; } if ($instance['show_title'] || $instance['show_byline']) { $header = ''; if (!empty($instance['show_title'])) { $title = get_the_title() ? get_the_title() : __('(no title)', 'genesis'); /** * Filter the featured post widget title. * * @since 2.2.0 * * @param string $title Featured post title. * @param array $instance { * Widget settings for this instance. * * @type string $title Widget title. * @type int $posts_cat ID of the post category. * @type int $posts_num Number of posts to show. * @type int $posts_offset Number of posts to skip when * retrieving. * @type string $orderby Field to order posts by. * @type string $order ASC fr ascending order, DESC for * descending order of posts. * @type bool $exclude_displayed True if posts shown in main output * should be excluded from this widget * output. * @type bool $show_image True if featured image should be * shown, false otherwise. * @type string $image_alignment Image alignment: alignnone, * alignleft, aligncenter or alignright. * @type string $image_size Name of the image size. * @type bool $show_gravatar True if author avatar should be * shown, false otherwise. * @type string $gravatar_alignment Author avatar alignment: alignnone, * alignleft or aligncenter. * @type int $gravatar_size Dimension of the author avatar. * @type bool $show_title True if featured page title should * be shown, false otherwise. * @type bool $show_byline True if post info should be shown, * false otherwise. * @type string $post_info Post info contents to show. * @type bool $show_content True if featured page content * should be shown, false otherwise. * @type int $content_limit Amount of content to show, in * characters. * @type int $more_text Text to use for More link. * @type int $extra_num Number of extra post titles to show. * @type string $extra_title Heading for extra posts. * @type bool $more_from_category True if showing category archive * link, false otherwise. * @type string $more_from_category_text Category archive link text. * } * @param array $args { * Widget display arguments. * * @type string $before_widget Markup or content to display before the widget. * @type string $before_title Markup or content to display before the widget title. * @type string $after_title Markup or content to display after the widget title. * @type string $after_widget Markup or content to display after the widget. * } */ $title = apply_filters('genesis_featured_post_title', $title, $instance, $args); $heading = genesis_a11y('headings') ? 'h4' : 'h2'; $header .= genesis_markup(array('open' => "<{$heading} class=\"entry-title\">", 'close' => "</{$heading}>", 'context' => 'widget-entry-title', 'content' => sprintf('<a href="%s">%s</a>', get_permalink(), $title), 'echo' => false)); } if (!empty($instance['show_byline']) && !empty($instance['post_info'])) { $header .= genesis_markup(array('open' => '<p class="entry-meta">', 'close' => '</p>', 'context' => 'widget-entry-meta', 'content' => do_shortcode($instance['post_info']), 'echo' => false)); } genesis_markup(array('open' => '<header class="entry-header">', 'close' => '</header>', 'context' => 'entry-header', 'content' => $header)); } if (!empty($instance['show_content'])) { genesis_markup(array('open' => '<div %s>', 'context' => 'entry-content')); if ('excerpt' == $instance['show_content']) { the_excerpt(); } elseif ('content-limit' == $instance['show_content']) { the_content_limit((int) $instance['content_limit'], genesis_a11y_more_link(esc_html($instance['more_text']))); } else { global $more; $orig_more = $more; $more = 0; the_content(genesis_a11y_more_link(esc_html($instance['more_text']))); $more = $orig_more; } genesis_markup(array('close' => '</div>', 'context' => 'entry-content')); } genesis_markup(array('close' => '</article>', 'context' => 'entry')); } } // Restore original query. wp_reset_query(); // The EXTRA Posts (list). if (!empty($instance['extra_num'])) { if (!empty($instance['extra_title'])) { echo $args['before_title'] . '<span class="more-posts-title">' . esc_html($instance['extra_title']) . '</span>' . $args['after_title']; } $offset = intval($instance['posts_num']) + intval($instance['posts_offset']); $query_args = array('cat' => $instance['posts_cat'], 'showposts' => $instance['extra_num'], 'offset' => $offset); $wp_query = new WP_Query($query_args); $listitems = ''; if (have_posts()) { while (have_posts()) { the_post(); $_genesis_displayed_ids[] = get_the_ID(); $listitems .= sprintf('<li><a href="%s">%s</a></li>', get_permalink(), get_the_title()); } if (mb_strlen($listitems) > 0) { printf('<ul class="more-posts">%s</ul>', $listitems); } } // Restore original query. wp_reset_query(); } if (!empty($instance['more_from_category']) && !empty($instance['posts_cat'])) { printf('<p class="more-from-category"><a href="%1$s" title="%2$s">%3$s</a></p>', esc_url(get_category_link($instance['posts_cat'])), esc_attr(get_cat_name($instance['posts_cat'])), esc_html($instance['more_from_category_text'])); } echo $args['after_widget']; }
public function create_contact_maps($contacts = array()) { global $people_email_inquiry_global_settings; global $people_contact_global_settings, $people_contact_grid_view_layout, $people_contact_location_map_settings, $people_contact_grid_view_icon; $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; global $contact_people_page_id; if (!is_page() || $contact_people_page_id != get_the_ID()) { return; } if (!is_array($contacts) || count($contacts) <= 0) { return; } wp_enqueue_script('jquery'); People_Contact_Hook_Filter::frontend_scripts_enqueue(); wp_enqueue_script('maps-googleapis', 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false'); wp_enqueue_script('fancybox', PEOPLE_CONTACT_JS_URL . '/fancybox/fancybox' . $suffix . '.js', array(), false, true); wp_enqueue_style('woocommerce_fancybox_styles', PEOPLE_CONTACT_JS_URL . '/fancybox/fancybox.css'); $ajax_popup_contact = wp_create_nonce("ajax-popup-contact"); $unique_id = rand(100, 10000); $profile_email_page_link = '#'; $grid_view_col = $people_contact_global_settings['grid_view_col']; $show_map = $people_contact_location_map_settings['hide_maps_frontend'] != 1 ? 1 : 0; $phone_icon = PEOPLE_CONTACT_IMAGE_URL . '/p_icon_phone.png'; $fax_icon = PEOPLE_CONTACT_IMAGE_URL . '/p_icon_fax.png'; $mobile_icon = PEOPLE_CONTACT_IMAGE_URL . '/p_icon_mobile.png'; $email_icon = PEOPLE_CONTACT_IMAGE_URL . '/p_icon_email.png'; $website_icon = PEOPLE_CONTACT_IMAGE_URL . '/p_icon_website.png'; $zoom_level = $people_contact_location_map_settings['zoom_level']; $map_type = $people_contact_location_map_settings['map_type']; $map_width_type = $people_contact_location_map_settings['map_width_type']; $map_width_responsive = $people_contact_location_map_settings['map_width_responsive']; $map_width_fixed = $people_contact_location_map_settings['map_width_fixed']; $map_height = $people_contact_location_map_settings['map_height']; if ('' == $map_type) { $map_type = 'ROADMAP'; } if ($zoom_level <= 0) { $zoom_level = 16; } if ($map_height <= 0) { $map_height = '400'; } if ($map_width_type == 'px') { $map_width_type = 'px'; if ($map_width_fixed <= 0) { $map_width = 100; } else { $map_width = $map_width_fixed; } } else { $map_width_type = '%'; $map_width = $map_width_responsive; } ?> <script type="text/javascript"> <?php if ($show_map != 0) { ?> var infowindow = null; jQuery(document).ready(function() { initialize<?php echo $unique_id; ?> (); }); function initialize<?php echo $unique_id; ?> () { if ( sites<?php echo $unique_id; ?> .length < 1 ) return false; var myOptions = { zoom: <?php echo $zoom_level; ?> , mapTypeId: google.maps.MapTypeId.<?php echo $map_type; ?> } var map = new google.maps.Map(document.getElementById("map_canvas<?php echo $unique_id; ?> "), myOptions); setMarkers<?php echo $unique_id; ?> (map, sites<?php echo $unique_id; ?> ); infowindow = new google.maps.InfoWindow({ content: "loading..." }); var bikeLayer = new google.maps.BicyclingLayer(); bikeLayer.setMap(map); } var sites<?php echo $unique_id; ?> = []; <?php $i = 0; if (is_array($contacts) && count($contacts) > 0) { foreach ($contacts as $key => $value) { if (0 == $value['enable_map_marker']) { continue; } if ((trim($value['c_latitude']) == '' || trim($value['c_longitude']) == '') && trim($value['c_address']) != '') { $url = 'http://maps.googleapis.com/maps/api/geocode/json?address=' . urlencode($value['c_address']) . '&sensor=false'; $geodata = file_get_contents($url); $geodata = json_decode($geodata); $value['c_latitude'] = $geodata->results[0]->geometry->location->lat; $value['c_longitude'] = $geodata->results[0]->geometry->location->lng; } if (trim($value['c_latitude']) == '' || trim($value['c_longitude']) == '') { continue; } $i++; if ($value['c_avatar'] != '') { $src = $value['c_avatar']; } else { $src = PEOPLE_CONTACT_IMAGE_URL . '/no-avatar.png'; } if (class_exists('People_Contact_3RD_ContactForm_Functions') && People_Contact_3RD_ContactForm_Functions::check_enable_3rd_contact_form()) { if ('' == trim($value['c_shortcode']) && '' == trim($people_email_inquiry_global_settings['contact_form_type_shortcode'])) { $value['c_email'] = ''; } } $profile_item = "['" . esc_attr(stripslashes($value['c_name'])) . "'," . $value['c_latitude'] . "," . $value['c_longitude'] . "," . $i . ",'" . esc_attr(stripslashes($value['c_address'])) . "'," . $value['id'] . ",'" . $src . "','" . trim(esc_attr(stripslashes($value['c_phone']))) . "','" . esc_attr(stripslashes($value['c_title'])) . "','" . trim(esc_attr(stripslashes($value['c_fax']))) . "','" . trim(esc_attr(stripslashes($value['c_mobile']))) . "','" . trim(esc_url(stripslashes($value['c_website']))) . "','" . trim(esc_attr(stripslashes($value['c_email']))) . "']"; ?> sites<?php echo $unique_id; ?> .push(<?php echo $profile_item; ?> ); <?php } if ($i < 1) { $show_map = 0; } } else { $show_map = 0; } ?> function setMarkers<?php echo $unique_id; ?> (map, markers) { var infotext = ''; var bounds = new google.maps.LatLngBounds (); jQuery.each( markers, function ( i, sites ) { var current_object = jQuery("div.people_item<?php echo $unique_id; ?> .people_item_id" + sites[5]); var siteLatLng = new google.maps.LatLng(sites[1], sites[2]); bounds.extend (siteLatLng); infotext = '<div class="infowindow"><p class="info_title">'+sites[8]+'</p><div class="info_avatar"><img src="'+sites[6]+'" /></div><div><p class="info_title2">'+sites[0]+'</p>'; if (sites[4] != '') infotext += '<p class="info_address">'+sites[4]+'</p>'; if (sites[12] != '') infotext += '<p><span class="p_icon_email"><img src="<?php echo $email_icon; ?> " style="width:auto;height:auto" /></span> <a style="cursor:pointer" class="direct_email direct_email<?php echo $unique_id; ?> direct_email_map" target="_blank" profile-id="'+sites[5]+'" href="<?php echo $profile_email_page_link; ?> '+sites[5]+'"><?php echo function_exists('icl_t') ? icl_t('a3 Contact People', 'Profile Cards - Email Link Text', __('Click Here', 'cup_cp')) : __('Click Here', 'cup_cp'); ?> </a></p>'; infotext += '</div></div>'; var marker = new google.maps.Marker({ position: siteLatLng, map: map, title: sites[0], zIndex: sites[3], html: infotext, c_id: sites[5]/*, icon : "/images/market.png"*/ }); if ( typeof(sites[1]) != 'undefined' && sites[1] != '' && typeof(sites[2]) != 'undefined' && sites[2] != '' ) { current_object.find(".people-entry-item").mouseover(function(i){ infowindow.setContent(marker.html); infowindow.open(map, marker); }); current_object.find(".people-entry-item").mouseout(function(i){ infowindow.close(); }); } if (sites[12] != '') { google.maps.event.addListener(marker, "click", function () { var c_id = this.c_id; var ajax_url='<?php echo admin_url('admin-ajax.php', 'relative'); ?> '+'?action=load_ajax_contact_form&contact_id='+c_id+'&security=<?php echo $ajax_popup_contact; ?> '; var popup_wide = 520; if ( people_group_ei_getWidth<?php echo $unique_id; ?> () <= 568 ) { popup_wide = '95%'; } jQuery.fancybox({ href: ajax_url, //content: ajax_url, centerOnScroll : <?php echo $people_email_inquiry_global_settings['fancybox_center_on_scroll']; ?> , transitionIn : '<?php echo $people_email_inquiry_global_settings['fancybox_transition_in']; ?> ', transitionOut: '<?php echo $people_email_inquiry_global_settings['fancybox_transition_out']; ?> ', easingIn: 'swing', easingOut: 'swing', speedIn : <?php echo $people_email_inquiry_global_settings['fancybox_speed_in']; ?> , speedOut : <?php echo $people_email_inquiry_global_settings['fancybox_speed_out']; ?> , width: popup_wide, autoScale: true, autoDimensions: true, height: 500, margin: 0, maxWidth: "95%", maxHeight: "80%", padding: 10, overlayColor: '<?php echo $people_email_inquiry_global_settings['fancybox_overlay_color']; ?> ', showCloseButton : true, openEffect : "none", closeEffect : "none" }); return false; }) } if ( typeof(sites[1]) != 'undefined' && sites[1] != '' && typeof(sites[2]) != 'undefined' && sites[2] != '' ) { google.maps.event.addListener(marker, 'mouseout', function() { //infowindow.close(); }); google.maps.event.addListener(marker, "mouseover", function () { infowindow.setContent(this.html); infowindow.open(map, this); }); } }); map.setCenter(bounds.getCenter()); map.fitBounds(bounds); google.maps.event.addListenerOnce(map, 'idle', function(){ if( map.getZoom() > <?php echo (int) $zoom_level; ?> ){ map.setZoom(<?php echo $zoom_level; ?> ); } }); } <?php } ?> var ajax_url2<?php echo $unique_id; ?> ='<?php echo admin_url('admin-ajax.php', 'relative'); ?> '+'?action=load_ajax_contact_form&security=<?php echo $ajax_popup_contact; ?> &contact_id='; jQuery(document).on("click", ".direct_email<?php echo $unique_id; ?> ", function(){ var c_id2 = jQuery(this).attr("profile-id"); var popup_wide2 = 520; if ( people_group_ei_getWidth<?php echo $unique_id; ?> () <= 568 ) { popup_wide2 = '95%'; } jQuery.fancybox({ href: ajax_url2<?php echo $unique_id; ?> +c_id2, //content: ajax_url, centerOnScroll : <?php echo $people_email_inquiry_global_settings['fancybox_center_on_scroll']; ?> , transitionIn : '<?php echo $people_email_inquiry_global_settings['fancybox_transition_in']; ?> ', transitionOut: '<?php echo $people_email_inquiry_global_settings['fancybox_transition_out']; ?> ', easingIn: 'swing', easingOut: 'swing', speedIn : <?php echo $people_email_inquiry_global_settings['fancybox_speed_in']; ?> , speedOut : <?php echo $people_email_inquiry_global_settings['fancybox_speed_out']; ?> , width: popup_wide2, autoScale: true, autoDimensions: true, height: 500, margin: 0, maxWidth: "95%", maxHeight: "80%", padding: 10, overlayColor: '<?php echo $people_email_inquiry_global_settings['fancybox_overlay_color']; ?> ', showCloseButton : true, openEffect : "none", closeEffect : "none" }); return false; }); var popupWindow<?php echo $unique_id; ?> =null; function profile_popup<?php echo $unique_id; ?> (url){ window.open(url,"_blank"); } function profile_parent_disable<?php echo $unique_id; ?> () { if(popupWindow<?php echo $unique_id; ?> && !popupWindow<?php echo $unique_id; ?> .closed) popupWindow<?php echo $unique_id; ?> .focus(); } function people_group_ei_getWidth<?php echo $unique_id; ?> () { xWidth = null; if(window.screen != null) xWidth = window.screen.availWidth; if(window.innerWidth != null) xWidth = window.innerWidth; if(document.body != null) xWidth = document.body.clientWidth; return xWidth; } </script> <?php wp_enqueue_script('jquery-masonry'); global $wp_version; $cur_wp_version = preg_replace('/-.*$/', '', $wp_version); ?> <script type="text/javascript"> jQuery(window).load(function(){ var grid_view_col = <?php echo $grid_view_col; ?> ; var screen_width = jQuery('body').width(); if(screen_width <= 750 && screen_width >= 481 ){ grid_view_col = 2; } jQuery('.people_box_content<?php echo $unique_id; ?> ').imagesLoaded(function(){ jQuery('.people_box_content<?php echo $unique_id; ?> ').masonry({ itemSelector: '.people_item<?php echo $unique_id; ?> ', <?php if (version_compare($cur_wp_version, '3.9', '<')) { ?> columnWidth: jQuery('.people_box_content<?php echo $unique_id; ?> ').width()/grid_view_col <?php } else { ?> columnWidth: '.people-grid-sizer' <?php } ?> }); }); }); jQuery(window).resize(function() { var grid_view_col = <?php echo $grid_view_col; ?> ; var screen_width = jQuery('body').width(); if(screen_width <= 750 && screen_width >= 481 ){ grid_view_col = 2; } jQuery('.people_box_content<?php echo $unique_id; ?> ').imagesLoaded(function(){ jQuery('.people_box_content<?php echo $unique_id; ?> ').masonry({ itemSelector: '.people_item<?php echo $unique_id; ?> ', <?php if (version_compare($cur_wp_version, '3.9', '<')) { ?> columnWidth: jQuery('.people_box_content<?php echo $unique_id; ?> ').width()/grid_view_col <?php } else { ?> columnWidth: '.people-grid-sizer' <?php } ?> }); }); }); </script> <?php $html = ''; if ($show_map != 0) { $html .= '<div style="clear:both"></div>'; $html .= '<div class="people-entry">'; $html .= '<div style="clear:both"></div>'; $html .= '<div id="map_canvas' . $unique_id . '" class="map_canvas_container" style="width: ' . $map_width . $map_width_type . '; height: ' . $map_height . 'px;float:left;"></div>'; $html .= '<div style="clear:both;margin-bottom:0em;" class="custom_title"></div>'; $html .= '<div style="clear:both;height:15px;"></div>'; $html .= '</div>'; } $grid_view_team_title = trim($people_contact_global_settings['grid_view_team_title']); if ($grid_view_team_title != '') { $html .= '<div class="custom_box_title"><h1 class="p_title">' . $grid_view_team_title . '</h1></div>'; } $html .= '<div style="clear:both;margin-bottom:1em;"></div>'; $html .= '<div class="people_box_content people_box_content' . $unique_id . ' pcol' . $grid_view_col . '"><div class="people-grid-sizer"></div>'; if (is_array($contacts) && count($contacts) > 0) { foreach ($contacts as $key => $value) { if ($value['c_avatar'] != '') { $src = $value['c_avatar']; $c_attachment_id = $value['c_attachment_id']; } else { $src = PEOPLE_CONTACT_IMAGE_URL . '/no-avatar.png'; $c_attachment_id = 0; } $html .= '<div class="people_item people_item' . $unique_id . ' people_item_id' . $value['id'] . '">'; $html .= '<div class="people-entry-item">'; $html .= '<div style="clear:both;"></div>'; $html .= '<div class="people-content-item">'; $img_output = '<img class="wp-image-' . $c_attachment_id . '" src="' . $src . '" />'; if (function_exists('wp_make_content_images_responsive')) { $img_output = wp_make_content_images_responsive($img_output); } $html .= '<h3 class="p_item_title">' . esc_attr(stripslashes($value['c_title'])) . '</h3>'; $html .= '<div class="p_content_left">' . $img_output . '</div>'; $html .= '<div class="p_content_right">'; $html .= '<h3 class="p_item_name">' . esc_attr(stripslashes($value['c_name'])) . '</h3>'; if (trim($value['c_about']) != '') { $html .= wpautop(wptexturize(stripslashes($value['c_about']))); } if (trim($value['c_phone']) != '') { $html .= '<p style="margin-bottom:5px;"><span class="p_icon_phone"><img src="' . $phone_icon . '" style="width:auto;height:auto" /></span> ' . esc_attr(stripslashes($value['c_phone'])) . '</p>'; } if (trim($value['c_fax']) != '') { $html .= '<p style="margin-bottom:5px;"><span class="p_icon_fax"><img src="' . $fax_icon . '" style="width:auto;height:auto" /></span> ' . esc_attr(stripslashes($value['c_fax'])) . '</p>'; } if (trim($value['c_mobile']) != '') { $html .= '<p style="margin-bottom:5px;"><span class="p_icon_mobile"><img src="' . $mobile_icon . '" style="width:auto;height:auto" /></span> ' . esc_attr(stripslashes($value['c_mobile'])) . '</p>'; } if (trim($value['c_website']) != '') { $html .= '<p style="margin-bottom:5px;"><span class="p_icon_website"><img src="' . $website_icon . '" style="width:auto;height:auto" /></span> <a href="' . esc_url(stripslashes($value['c_website'])) . '" target="_blank">' . (function_exists('icl_t') ? icl_t('a3 Contact People', 'Profile Cards - Website Link Text', __('Visit Website', 'cup_cp')) : __('Visit Website', 'cup_cp')) . '</a></p>'; } if (trim($value['c_email']) != '') { $html .= '<p style="margin-bottom:0px;"><span class="p_icon_email"><img src="' . $email_icon . '" style="width:auto;height:auto" /></span> <a style="cursor:pointer" class="direct_email direct_email' . $unique_id . '" profile-id="' . $value['id'] . '" href="#' . $value['id'] . '">' . (function_exists('icl_t') ? icl_t('a3 Contact People', 'Profile Cards - Email Link Text', __('Click Here', 'cup_cp')) : __('Click Here', 'cup_cp')) . '</a></p>'; } $html .= '</div>'; $html .= '</div>'; $html .= '<div style="clear:both;"></div>'; $html .= '</div>'; $html .= '</div>'; } } $html .= '</div>'; $html .= '<div style="clear:both"></div>'; return $html; }
/** * Prints HTML with post's featured image. * * @param bool $skip Skips the image wrapper class. */ function gently_featured_image($skip = false) { if (has_post_thumbnail()) { if ($skip) { echo '<div>'; } else { if (!is_single() && !is_page()) { echo '<div class="entry-image">'; } else { echo '<div class="featured-image">'; } } $image = sprintf('<a href="%s" title="%s">' . get_the_post_thumbnail() . '</a>', get_the_permalink(), the_title_attribute('echo=0')); // Add srcset and sizes to image in WordPress >= 4.4 if (function_exists('wp_make_content_images_responsive')) { echo wp_make_content_images_responsive($image); } else { echo $image; } echo '</div>'; } }
/** * Echo the widget content. * * @since 0.1.8 * * @global WP_Query $wp_query Query object. * @global int $more * * @param array $args Display arguments including `before_title`, `after_title`, * `before_widget`, and `after_widget`. * @param array $instance The settings for the particular instance of the widget. */ function widget($args, $instance) { global $wp_query; // Merge with defaults. $instance = wp_parse_args((array) $instance, $this->defaults); echo $args['before_widget']; // Set up the author bio. if (!empty($instance['title'])) { echo $args['before_title'] . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $args['after_title']; } $wp_query = new WP_Query(array('page_id' => $instance['page_id'])); if (have_posts()) { while (have_posts()) { the_post(); genesis_markup(array('open' => '<article %s>', 'context' => 'entry')); $image = genesis_get_image(array('format' => 'html', 'size' => $instance['image_size'], 'context' => 'featured-page-widget', 'attr' => genesis_parse_attr('entry-image-widget', array('alt' => get_the_title())))); if ($instance['show_image'] && $image) { $role = empty($instance['show_title']) ? '' : 'aria-hidden="true"'; printf('<a href="%s" class="%s" %s>%s</a>', get_permalink(), esc_attr($instance['image_alignment']), $role, wp_make_content_images_responsive($image)); } if (!empty($instance['show_title'])) { $title = get_the_title() ? get_the_title() : __('(no title)', 'genesis'); /** * Filter the featured page widget title. * * @since 2.2.0 * * @param string $title Featured page title. * @param array $instance { * Widget settings for this instance. * * @type string $title Widget title. * @type int $page_id ID of the featured page. * @type bool $show_image True if featured image should be shown, false * otherwise. * @type string $image_alignment Image alignment: alignnone, alignleft, * aligncenter or alignright. * @type string $image_size Name of the image size. * @type bool $show_title True if featured page title should be shown, * false otherwise. * @type bool $show_content True if featured page content should be shown, * false otherwise. * @type int $content_limit Amount of content to show, in characters. * @type int $more_text Text to use for More link. * } * @param array $args { * Widget display arguments. * * @type string $before_widget Markup or content to display before the widget. * @type string $before_title Markup or content to display before the widget title. * @type string $after_title Markup or content to display after the widget title. * @type string $after_widget Markup or content to display after the widget. * } */ $title = apply_filters('genesis_featured_page_title', $title, $instance, $args); $heading = genesis_a11y('headings') ? 'h4' : 'h2'; genesis_markup(array('open' => "<header class=\"entry-header\"><{$heading} class=\"entry-title\">", 'close' => "</{$heading}></header>", 'context' => 'widget-entry-title', 'content' => sprintf('<a href="%s">%s</a>', get_permalink(), $title))); } if (!empty($instance['show_content'])) { genesis_markup(array('open' => '<div %s>', 'context' => 'entry-content')); if (empty($instance['content_limit'])) { global $more; $orig_more = $more; $more = 0; the_content(genesis_a11y_more_link($instance['more_text'])); $more = $orig_more; } else { the_content_limit((int) $instance['content_limit'], genesis_a11y_more_link(esc_html($instance['more_text']))); } genesis_markup(array('close' => '</div>', 'context' => 'entry-content')); } genesis_markup(array('close' => '</article>', 'context' => 'entry')); } } // Restore original query. wp_reset_query(); echo $args['after_widget']; }