I am moving a site from a Genesis theme to Colorlib theme. The genesis theme includes add_action( 'genesis_before_while', 'custom function' ); in a custom archive page, which loads restricted content from a template part. Is there a standard WP hook equivalent? or a work-around?

  • if there is there's no guarantee the Colorlib theme implements it, what/when exactly does genesis_before_while run?
    – Tom J Nowell
    Jan 2, 2022 at 0:42
  • Before the Loop Hook - genesis_before_while it goes above while_posts
    – MARWEL58
    Jan 2, 2022 at 2:40
  • Here a comment about the hook The genesis_before_while runs after the if( have_posts() ) * and before while( have_posts() ) : the_post();
    – MARWEL58
    Jan 2, 2022 at 2:43

2 Answers 2


After thinking through Tom Nowell's advice it occurred to me I could create a custom hook and place it after if( have_posts(). This worked like a charm. Thanks again. https://developer.wordpress.org/plugins/hooks/custom-hooks/

  • note that this will be lost when you apply updates to the Colorlib theme
    – Tom J Nowell
    Jan 3, 2022 at 0:06
  • Yes. I turned off auto updates on the theme. It is buying me much-needed time to develop a new query, so this works.
    – MARWEL58
    Jan 3, 2022 at 4:01

It's possible there's an equivalent filter in the new theme but there is no standard general hook you can use that acts as a direct replacement like for like.

You should check the Colorlib themes documentation and support, but keep in mind Genesis relies heavily on custom hooks by design, much more so than other themes. You might be able to manually add a hook in a child theme if Colorlib is built properly.

  • Thanks. I sent this question to the Colorlib folks.. I may need to recreate the whole query to fit the new theme.
    – MARWEL58
    Jan 2, 2022 at 21:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.