php - How to change output\input template in foogallery with hooks? -
i need change output tamplate. exemple:
now have template wich store in database
<div id="foogallery-gallery-67" class="foogallery-container foogallery-default foogallery-link-image foogallery-lightbox-foobox-free spacing-width-10 hover-effect-zoom3  border-style-square-white alignment-center hover-caption-simple foogallery-default-loading">     <a  href="http://wordpress.local/wp-content/uploads/2017/08/222-1.jpg" data-caption-title="title" data-caption-desc="description text" data-attachment-id="128" class="">         <img  src="http://wordpress.local/wp-content/uploads/cache/2017/08/222-1/705461751.jpg" width="150" height="150" />     </a> </div> i need add 1 data-* attribute (data-custom)
<div id="foogallery-gallery-67" class="foogallery-container foogallery-default foogallery-link-image foogallery-lightbox-foobox-free spacing-width-10 hover-effect-zoom3  border-style-square-white alignment-center hover-caption-simple foogallery-default-loading">     <a  href="http://wordpress.local/wp-content/uploads/2017/08/222-1.jpg" data-caption-title="title" data-caption-desc="description text" data-attachment-id="128" data-custom="" class="">         <img  src="http://wordpress.local/wp-content/uploads/cache/2017/08/222-1/705461751.jpg" width="150" height="150" />     </a> </div> i know can add directly database, i'm interested in how can redefine output , input function in future there no problem.
and again answer own question
for example have such structure of plugin:
class plugin() {     public function __construct()     {      } }  $startplugin = new plugin(); and need change output foogallary template. foogallary have filter, can change output tamplate foogallery_attachment_html_link_attributes. change our class, filter.
class plugin() {     public function __construct()     {         add_filter('foogallery_attachment_html_link_attributes', array($this, 'addfoogallerycategory'), 10, 3);     }      public function addfoogallerycategory($attr, $args, $attachment)     {         $attr['data-category'] = 'category';         return $attr;     } }  $startplugin = new plugin(); it's easy, did not find solution. maybe helped someone.
Comments
Post a Comment