Back to Index

Theme Hooks (Actions & Filters)

Defining the page content wrapper class:

/** * Example of bigwigs_set_content_class hooked. * @see custom-functions.php */ function bigwigs_set_wide_content_class( $classes ) { if ( is_page_template( array( 'template-wide.php' ) ) ) { $classes = ''; $classes[] = 'col-md-12'; } return array_unique( $classes ); } add_filter( 'bigwigs_set_content_class', 'bigwigs_set_wide_content_class' );
Code language: PHP (php)

Add your own class to the content container block for a specific page:

function my_custom_wrapper($content_wrapper) { if( is_page('my-page') ){ // specific page slug or ID $content_wrapper = '<div class="container my-page-wrap">'; // where my-page-wrap it is your custom class } return $content_wrapper; } add_filter('bigwigs_content_wrapper_start','my_custom_wrapper');
Code language: PHP (php)

Adding a closing tag to the page/post content container:

function my_custom_wrapper_end($content_wrapper) { if( is_page('my-page') ){ // specific page slug or ID $content_wrapper = '</div>'; } return $content_wrapper; } add_filter('bigwigs_content_wrapper_end','my_custom_wrapper_end');
Code language: PHP (php)

Add the button refer to comment on a page or post when a single post is displayed:

/** * Example use hooks of theme * Add button to comment * @see jumbotron-singular.php */ function bigwigs_add_tocomment_link(){ if( !is_front_page() && is_singular(array('post','page')) ){ if( ! post_password_required() && comments_open() ){ ?> <a href="<?php esc_url( comments_link() ); ?>" class="comment-link btn btn-dark my-2"> <?php echo esc_html( 'Leave Comment', 'bigwigs-pro' ); ?> </a> <?php } } } add_action('bigwigs_jumbotron_container_end','bigwigs_add_tocomment_link');
Code language: JavaScript (javascript)

Adding the back to top button:

/** * Example use hooks of theme * Add scroll-to-top button into footer * @see footer.php */ function bigwigs_add_back_top(){ if( ! wp_is_mobile() ){ echo '<a id="back-to-top" href="#" class="btn btn-dark btn-sm back-to-top" role="button"></a>'; } } add_action('bigwigs_footer','bigwigs_add_back_top',10);
Code language: PHP (php)

Adding a menu item with an icon:

/** * Example of add filter for append an element. * * @see additional-items.php * @see custom-functions.php * bigwigs_add_navbar_items */ function bigwigs_add_new_navbar_item( $items ) { $items .= '<div class="user-btn pl-lg-2 d-inline"><a href="#" class="dashicons dashicons-admin-users"></a></div>'; return $items; } add_filter( 'bigwigs_add_navbar_items', 'bigwigs_add_new_navbar_item' );
Code language: PHP (php)

Continue soon…