public static function inject_post_content($content) { global $post; if ($post->post_type != 'akvopedia') { return $content; } $title_id = 'akvopedia-title-' . $post->ID; $div_id = 'akvopedia-' . $post->ID; $gadget = new AkvopediaGadget($post->post_title, $title_id, $div_id, array('scrollToElement' => 'body', 'catchLinkClicks' => false)); return $gadget->getRendered(); }
/** * Outputs the content of the widget * * @param array $args * @param array $instance */ public function widget($args, $instance) { $title = $this->c(self::AKVOPEDIA_ARTICLE, $instance); $id = 'akvopedia-' . $this->id; $title_id = 'akvopedia-title-' . $this->id; $columns = $this->c(self::COLUMNS, $instance); if ($columns < 1 || $columns > 4) { $columns = 1; } $amount = 3 * $columns; $gadget = new AkvopediaGadget($title, $title_id, $id, array('catchLinkClicks' => $instance[self::CATCH_CLICKS] == 'on')); echo $gadget->getScript(); ?> <div class="col-md-<?php echo $amount; ?> eq"> <div class="box-wrap dyno <?php if (\is_front_page()) { echo 'home'; } ?> "> <div class="header-wrap"> <h2 id="<?php echo $title_id; ?> "><?php echo $title; ?> </h2> </div> <div class="infobar akvopedia"> <span> </span> <span class="type"><span>Akvopedia</span></span> </div> <?php echo $gadget->getHtmlElement(); ?> </div> </div> <?php }