/** * replace the post gallery with unite gallery */ function unitegallery_postgallery($output = '', $atts, $content = false, $tag = false) { $alias = UniteFunctionsUG::getVal($atts, "unitegallery"); if (empty($alias)) { return $output; } $ids = UniteFunctionsUG::getVal($atts, "ids"); if (empty($ids)) { return $output; } //get items $arrIDs = explode(",", $ids); $arrItems = UniteFunctionsWPUG::getArrItemsFromAttachments($arrIDs); //output gallery $objItems = new UniteGalleryItems(); $arrUniteItems = $objItems->getItemsFromArray($arrItems); $content = HelperUG::outputGallery($alias, null, "alias", $arrUniteItems); return $content; }
/** * * widget output */ public function widget($args, $instance) { $title = UniteFunctionsUG::getVal($instance, "title"); $galleryID = UniteFunctionsUG::getVal($instance, "unitegallery"); $categoryID = UniteFunctionsUG::getVal($instance, "unitegallery_cat"); if (empty($galleryID)) { return false; } //widget output $beforeWidget = UniteFunctionsUG::getVal($args, "before_widget"); $afterWidget = UniteFunctionsUG::getVal($args, "after_widget"); $beforeTitle = UniteFunctionsUG::getVal($args, "before_title"); $afterTitle = UniteFunctionsUG::getVal($args, "after_title"); echo $beforeWidget; if (!empty($title)) { echo $beforeTitle . $title . $afterTitle; } $content = HelperUG::outputGallery($galleryID, $categoryID, "id"); echo $content; echo $afterWidget; }