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; } }
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; } }
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; }
/** * 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; }