Пример #1
0
 /**
  * Displays the Widget
  *
  */
 function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', empty($instance['title']) ? ' ' : $instance['title']);
     //		$lineOne = empty($instance['lineOne']) ? 'Hello' : $instance['lineOne'];
     //		$lineTwo = empty($instance['lineTwo']) ? 'World' : $instance['lineTwo'];
     $mimetypes = split(',', empty($instance['mimetypes']) ? 'image' : $instance['mimetypes']);
     $size = empty($instance['size']) ? 'medium' : $instance['size'];
     # Before the widget
     echo $before_widget;
     # The title
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     # Make the Hello World Example widget
     //		echo '<div style="text-align:center;padding:10px;">' . $lineOne . '<br />' . $lineTwo . "</div>";
     foreach ($mimetypes as $mimetype) {
         //			print "<h3>$mimetype</h3>";
         echo "<ul class='attachments {$mimetype}'>";
         is_drawImageGallery($post_id = null, $size = $size, $mimetype = trim($mimetype));
         echo "</ul>";
     }
     # After the widget
     echo $after_widget;
 }
Пример #2
0
<!-- template gallery list -->
    <div class="gallery-container">
      <div class="gallery">
      <ul id="gallery-<?php 
the_ID();
?>
">
        <?php 
$attachments = is_getAttachments();
is_drawImageGallery();
$total_attachments = count($attachments);
// videos [youtube=http://www.youtube.com/watch?v=JaNH56Vpg-A]
// shortcode processor
foreach ($attachments['video'] as $v) {
    echo '<li class="gallery-node type-video">';
    if (shortcode_exists('embed')) {
        global $wp_embed;
        $code = '[embed width="450" height="320"]' . $v->src . '[/embed]';
        echo $wp_embed->run_shortcode($code);
    } else {
        echo $v->src;
    }
    echo '</li>';
}
?>
      </ul>
      </div>
      <div class="gallery-navigation">
        <nav class="clearfix <?php 
if ($total_attachments < 2) {
    echo 'one-attachment';
Пример #3
0
function ajax_is_attachments()
{
    $post_id = $_REQUEST['id'];
    $type = $_REQUEST['type'];
    if (empty($post_id)) {
        return;
    }
    //		print $post_id;
    is_drawImageGallery($post_id, 'medium', $type);
    //	print "OI " . $_REQUEST['string'];
    //		print $r->post_title;
    //		print json_encode(item);
    //		array_push($response, $item);
    //	need to encode title to preserve comma's
    //	print '{' . json_encode($response) . '}';
    return;
}