示例#1
0
 /**
  * Render the child shortcode
  * @param  array $args	 Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string		  HTML output
  */
 function render_child($args, $content = '')
 {
     $defaults = FusionCore_Plugin::set_shortcode_defaults(array('alt' => '', 'image' => '', 'link' => '', 'linktarget' => '_self'), $args);
     extract($defaults);
     self::$child_args = $defaults;
     $image_id = FusionCore_Plugin::get_attachment_id_from_url($image);
     if (!$alt && empty($alt) && $image_id) {
         self::$child_args['alt'] = $alt = get_post_meta($image_id, '_wp_attachment_image_alt', true);
     }
     if ($image_id) {
         self::$child_args['title_attr'] = get_post_field('post_excerpt', $image_id);
     }
     $output = sprintf('<img src="%s" alt="%s" />', $image, $alt);
     if ($link || self::$parent_args['lightbox'] == 'yes') {
         $output = sprintf('<a %s>%s</a>', FusionCore_Plugin::attributes('image-carousel-shortcode-slide-link'), $output);
     }
     $html = sprintf('<li><div %s>%s</div></li>', FusionCore_Plugin::attributes('image'), $output);
     return $html;
 }