Skip to content

Sidebar Insert Filter - hook #786

Answered by crftwrk
ePiliK asked this question in Q&A
May 31, 2024 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

This is because there is no hook in sidebar.php, you have to create one.

Create hook in child's functions.php:

function add_facet_to_sidebar_hook() {
  do_action('add_facet_to_sidebar_hook');
}
function my_custom_facet_content() {
  if (is_shop() || is_product_category() || is_product_tag()) {
    echo '<div class="alert alert-info">This is my custom facet content!</div>';
  }
}

add_action( 'add_facet_to_sidebar_hook', 'my_custom_facet_content' );

Copy sidebar.php to your child and insert the hook where you want:

<?php add_facet_to_sidebar_hook(); ?>

Solved?

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ePiliK
Comment options

@crftwrk
Comment options

Answer selected by ePiliK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants