* If you want to hook to enable or add feature to the theme, please use \BootstrapBasic4\BootstrapBasic4() class. */ class Bsb4Hooks { /** * Add actions or filters that will be hook into WordPress and make changes to this theme. * * To use, just code as follows: * * $Bsb4Hooks = new \BootstrapBasic4\Hooks\Bsb4Hooks(); * $Bsb4Hooks->addActionsFilters(); * * That's it. */ public function addActionsFilters() { // Change title separator from - to the configured in functions.php file. add_filter('document_title_separator', array(&$this, 'modifyTitleSeparator'), 10, 1); // Modift excerpt more text. (default is [...].) add_filter('excerpt_more', array(&$this, 'modifyExcerptMore'), 10, 1); // Modify pagination page link add_filter('wp_link_pages_link', array(&$this, 'paginationPageLink'), 10, 2); // Modify comment reply link class add_filter('comment_reply_link', array(&$this, 'modifyCommentReplyLinkClass'), 10, 1); // Modify comment navigation link attributes. add_filter('previous_comments_link_attributes', array($this, 'modifyCommentNavLinkPrevious'), 10, 1); add_filter('next_comments_link_attributes', array($this, 'modifyCommentNavLinkNext'), 10, 1); }// addActionsFilters /** * Modify comment navigation link * * @param string $attributes * @param string $nav * @return string */ protected function modifyCommentNavLink($attributes, $nav) { $attributes = 'class="btn btn-secondary'; if ($nav == 'next') { $attributes .= ' float-right'; } else { $attributes .= ' float-left'; } $attributes .= '"'; return $attributes; }// modifyCommentNavLink /** * Modify comment navigation link * * @param string $attributes * @return string */ public function modifyCommentNavLinkNext($attributes) { return $this->modifyCommentNavLink($attributes, 'next'); }// modifyCommentNavLinkNext /** * Modify comment navigation link * * @param string $attributes * @return string */ public function modifyCommentNavLinkPrevious($attributes) { return $this->modifyCommentNavLink($attributes, 'previous'); }// modifyCommentNavLinkPrevious /** * Modify comment reply link class. * * @access private Do not access this method directly. This is for hook callback not for direct call. * @param string $class The comment reply link class. * @return string Return modified class. */ public function modifyCommentReplyLinkClass($class) { $class = str_ireplace('comment-reply-link', 'comment-reply-link btn btn-secondary btn-sm', $class); $class = str_ireplace('comment-reply-login', 'comment-reply-login btn btn-secondary btn-sm', $class); return $class; }// modifyCommentReplyLinkClass /** * Modify excerpt more text. * * @access private Do not access this method directly. This is for hook callback not for direct call. * @param string $more Default more text is [...]. * @return string Return the new more text. */ public function modifyExcerptMore($more) { return ' …'; }// modifyExcerptMore /** * Modify title separator. * * @access private Do not access this method directly. This is for hook callback not for direct call. * @global string $bootstrapbasic4_title_separator * @return string Return the new title separator. */ public function modifyTitleSeparator() { global $bootstrapbasic4_title_separator; return $bootstrapbasic4_title_separator; }// modifyTitleSeparator /** * Modify pagination page link * * @access private Do not access this method directly. This is for hook callback not for direct call. * @param string $link * @param integer $i */ public function paginationPageLink($link, $i) { if (strpos($link, '' . $link . ''; } else { $link = str_ireplace('' . $link . ''; } }// paginationPageLink } }