hook for category page

Community Forums Forums Design Tips and Tricks hook for category page

This topic is: resolved

Tagged: ,

This topic contains 1 reply, has 1 voice, and was last updated by  staceyzav 5 months, 1 week ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #91459

    staceyzav
    Participant
    Post count: 12

    Hi, I need to create a custom loop on a specific category… but I can’t seem to figure out the correct code for my functions.php . Any help is greatly appreciated.

    This is my non-working code that I’ve come up with so far for my page

    if (is_category('trip-examples')) { 
    remove_action( 'genesis_loop', 'genesis_do_loop' );
    add_action( 'genesis_loop', 'my_custom_loop' );
     }
    
    function my_custom_loop() {
    
     echo 'custom loop code will go here - I can figure this part out, just need help figuring out how to replace the loop!';
    	}
    • This topic was modified 5 months, 1 week ago by  staceyzav.
    • This topic was modified 5 months, 1 week ago by  staceyzav.
    #91494

    staceyzav
    Participant
    Post count: 12

    I figured it out! for anyone else who may need it:

    add_action('genesis_before','change_some_actions');
    function change_some_actions() {
     
        if (is_category('7')) {
     
           remove_action( 'genesis_loop', 'genesis_do_loop' );
    add_action( 'genesis_loop', 'my_custom_loop' );
        }   
     
    }
    
    	
    
    /** Code for custom loop */
    
    function my_custom_loop() {
    
     echo 'custom loop here';
    	}
    • This reply was modified 5 months, 1 week ago by  staceyzav.
    • This reply was modified 5 months, 1 week ago by  staceyzav.
    • This reply was modified 5 months, 1 week ago by  staceyzav.
    • This reply was modified 5 months, 1 week ago by  staceyzav.
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.