Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #47837
    MIchael
    Member

    I was able to do this without much trouble for the slider but now have been requested to move the featured content to a new position. I can move the featured content just fine, but the I cannot seem to remove it from the original location.

    Here is the code im using. Would someone please tell me what I have done wrong…

    function remove_featured_content(){
    remove_action(‘catchkathmandu_before_main’,’catchkathmandu_homepage_featured_content’,10 );
    }

    add_action(‘catchkathmandu_main’,’remove_featured_content’);

    function move_featured_content(){
    remove_action(‘catchkathmandu_before_main’,’catchkathmandu_homepage_featured_content’, 10);
    }
    add_action(‘catchkathmandu_special_content’,’move_featured_content’);
    add_action(‘catchkathmandu_special_content’,’catchkathmandu_homepage_featured_content’);

    #47862
    Sakin
    Keymaster

    @MIchael: To remove action in child theme, you need to hook with init action. See the code as below:

    // Removing the Default Action Hook
    function unhook_catchkathmandu_functions() {
    	//Add in you hook here
    	remove_action( 'catchkathmandu_before_main', 'catchkathmandu_homepage_featured_position', 5 );
    }
    add_action( 'init', 'unhook_catchkathmandu_functions' );
    #47876
    MIchael
    Member

    Sorry to say that didn’t work. I put in your code and nothing changes the original featured content is still in place.

    here is the code used for http://airstream.michaelsmithcreative.com
    // Removing the Default Action Hook
    function unhook_catchkathmandu_functions() {
    //Add in you hook here
    remove_action( ‘catchkathmandu_before_main’, ‘catchkathmandu_homepage_featured_position’, 5 );
    }
    add_action( ‘init’, ‘unhook_catchkathmandu_functions’ );

    function move_featured_content(){
    remove_action(‘catchkathmandu_before_main’,’catchkathmandu_homepage_featured_content’, 10);
    }
    add_action(‘catchkathmandu_special_content’,’move_featured_content’);
    add_action(‘catchkathmandu_special_content’,’catchkathmandu_homepage_featured_content’);

    #47882
    MIchael
    Member

    Update. fixed it.

    There is no priority assigned in the original function, so by adding “, 5” at the end of the remove action the removed action wont work. removed the priority and the remove action works great. t

    Thanks for the tip on init hook

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Move catchkathmandu_homepage_featured_content to new action hook’ is closed to new replies.