I am trying to re-arrange Woocommerce Sensei hooked content. Basically, I would like to have course_image
at the top (high priority).
// code in sensei /includes/hooks/template.php
<?php
/**
* Fires just before the course content in the content-course.php file.
*
* @since 1.9
*
* @param integer $course_id
*
* @hooked Sensei_Templates::the_title - 5
* @hooked Sensei()->course->course_image - 10
* @hooked Sensei()->course->the_course_meta - 20
*/
do_action('sensei_course_content_inside_before', get_the_ID() );
?>
I added: remove_action( 'sensei_course_content_inside_before', 'course_image', 10);
in my Theme's function.php
but it doesn't work.
How do I re-arrange above title, image and meta
?
Please suggest.
Update
//code called add_action
// add course content title to the courses on the archive page
add_action('sensei_course_content_inside_before', array( 'Sensei_Templates', 'the_title' ) ,5, 1 );
// add the course image above the content
add_action('sensei_course_content_inside_before', array( $this->course, 'course_image' ) ,10, 1 ); //if I change 10 to 4 in their code directly, it works
Code can be found here
UPDATE 2
I get following on:
global $wp_filter;
echo '<pre>';
print_r( $wp_filter['sensei_course_content_inside_before'] );
echo '</pre>';
//output
WP_Hook Object
(
[callbacks] => Array
(
[5] => Array
(
[Sensei_Templates::the_title] => Array
(
[function] => Array
(
[0] => Sensei_Templates
[1] => the_title
)
[accepted_args] => 1
)
)
[10] => Array
(
[0000000032a2e99b00007fe8c14d85d0the_course_meta] => Array
(
[function] => Array
(
[0] => WooThemes_Sensei_Course Object
(
[token] => course
[meta_fields] => Array
(
[0] => course_prerequisite
[1] => course_featured
[2] => course_video_embed
[3] => course_woocommerce_product
)
[my_courses_page] =>
)
[1] => the_course_meta
)
[accepted_args] => 1
)
[10] => Array
(
[0000000032a2e99b00007fe8c14d85d0course_image] => Array
(
[function] => Array
(
[0] => WooThemes_Sensei_Course Object
(
[token] => course
[meta_fields] => Array
(
[0] => course_prerequisite
[1] => course_featured
[2] => course_video_embed
[3] => course_woocommerce_product
)
[my_courses_page] =>
)
[1] => course_image
)
[accepted_args] => 1
)
)
[0000000032a2e99b00007fe8c14d85d0content_before_backwards_compatibility_hooks] => Array
(
[function] => Array
(
[0] => WooThemes_Sensei_Course Object
(
[token] => course
[meta_fields] => Array
(
[0] => course_prerequisite
[1] => course_featured
[2] => course_video_embed
[3] => course_woocommerce_product
)
[my_courses_page] =>
)
[1] => content_before_backwards_compatibility_hooks
)
[accepted_args] => 1
)
)
)
[iterations:WP_Hook:private] => Array
(
)
[current_priority:WP_Hook:private] => Array
(
)
[nesting_level:WP_Hook:private] => 0
[doing_action:WP_Hook:private] =>
)
remove_action()
code? Maybe the action wasn't added yet (in terms of code execution order)theme/my-theme/functions.php
.add_action('init', 'my_func');
withmy_func
having theremove_action()
, right? Tryadd_action('init', 'my_function', 99);
instead - but it depends on how/when Sensei adds the action, I don't know that