コード例 #1
0
 public function gallery_custom_column_content($column)
 {
     global $post;
     switch ($column) {
         case FOOGALLERY_CPT_GALLERY . '_template':
             $gallery = FooGallery::get($post);
             $template = $gallery->gallery_template_details();
             if (false !== $template) {
                 echo $template['name'];
             }
             break;
         case FOOGALLERY_CPT_GALLERY . '_count':
             $gallery = FooGallery::get($post);
             echo $gallery->image_count();
             break;
         case FOOGALLERY_CPT_GALLERY . '_shortcode':
             $gallery = FooGallery::get($post);
             $shortcode = $gallery->shortcode();
             echo '<input type="text" readonly="readonly" size="' . strlen($shortcode) . '" value="' . esc_attr($shortcode) . '" class="foogallery-shortcode" />';
             $this->include_clipboard_script = true;
             break;
         case 'icon':
             $gallery = FooGallery::get($post);
             $img = $gallery->featured_image_html(array(80, 60), true);
             if ($img) {
                 echo $img;
             }
             break;
     }
 }
コード例 #2
0
ファイル: class-columns.php プロジェクト: GolgoSoft/KeenerWP
        public function gallery_custom_column_content($column)
        {
            global $post;
            switch ($column) {
                case FOOGALLERY_CPT_GALLERY . '_template':
                    $gallery = FooGallery::get($post);
                    $template = $gallery->gallery_template_details();
                    if (false !== $template) {
                        echo $template['name'];
                    }
                    break;
                case FOOGALLERY_CPT_GALLERY . '_count':
                    $gallery = FooGallery::get($post);
                    echo $gallery->image_count();
                    break;
                case FOOGALLERY_CPT_GALLERY . '_shortcode':
                    $gallery = FooGallery::get($post);
                    $shortcode = $gallery->shortcode();
                    echo '<code id="foogallery-copy-shortcode" data-clipboard-text="' . esc_attr($shortcode) . '"
					  title="' . esc_attr__('Click to copy to your clipboard', 'foogallery') . '"
					  class="foogallery-shortcode">' . $shortcode . '</code>';
                    $this->include_clipboard_script = true;
                    break;
                case 'icon':
                    $gallery = FooGallery::get($post);
                    $img = $gallery->featured_image_html(array(80, 60), true);
                    if ($img) {
                        echo $img;
                    }
                    break;
            }
        }
コード例 #3
0
 public function get_gallery($post)
 {
     if (!isset($this->_gallery)) {
         $this->_gallery = FooGallery::get($post);
         //attempt to load default gallery settings from another gallery, as per FooGallery settings page
         $this->_gallery->load_default_settings_if_new();
     }
     return $this->_gallery;
 }
コード例 #4
0
/**
 * Returns all FooGallery galleries
 *
 * @return FooGallery[] array of FooGallery galleries
 */
function foogallery_get_all_galleries($excludes = false)
{
    $args = array('post_type' => FOOGALLERY_CPT_GALLERY, 'post_status' => array('publish', 'draft'), 'cache_results' => false, 'nopaging' => true);
    if (is_array($excludes)) {
        $args['post__not_in'] = $excludes;
    }
    $gallery_posts = get_posts($args);
    if (empty($gallery_posts)) {
        return array();
    }
    $galleries = array();
    foreach ($gallery_posts as $post) {
        $galleries[] = FooGallery::get($post);
    }
    return $galleries;
}