Tagged: php
- This topic has 3 replies, 2 voices, and was last updated 9 years, 10 months ago by MIchael.
-
AuthorPosts
-
November 21, 2014 at 2:23 am #47837MIchaelMember
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’);November 21, 2014 at 3:30 pm #47862SakinKeymaster@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' );
November 21, 2014 at 7:17 pm #47876MIchaelMemberSorry 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’);November 21, 2014 at 8:44 pm #47882MIchaelMemberUpdate. 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
-
AuthorPosts
- The topic ‘Move catchkathmandu_homepage_featured_content to new action hook’ is closed to new replies.