0

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?

3
  • 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 at 0:42
  • Before the Loop Hook - genesis_before_while it goes above while_posts
    – MARWEL58
    Jan 2 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 at 2:43
0

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/

2
  • note that this will be lost when you apply updates to the Colorlib theme
    – Tom J Nowell
    Jan 3 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 at 4:01
0

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.

1
  • 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 at 21:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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