Support » Plugin: Sensei LMS » Reorder contents of ‘sensei_course_content_inside_before’

  • Resolved jmbronson

    (@jmbronson)


    I need to customize (reorder) the output of the HTML contents of ‘sensei_course_content_inside_before’ on the main courses archive page.

    I’m trying to customize the display of course info (thumb image, meta details, titles) but as of right now I have to position these elements absolutely because I cannot find the correct template that contains these elements, but this is a dirty trick that I’d rather not do.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Donna Peplinskie

    (@donnapep)

    Hi,

    Since the ordering of these elements is determined by the priority that is set on the sensei_course_content_inside_before hooks, you’ll need to first remove the hooks that Sensei LMS adds, and then add your own, using the priority to set the display order.

    For example, the following code will output the meta, then the image, then the title:

    function reorder_course_archive_details() {
      remove_action( 'sensei_course_content_inside_before', array( Sensei()->course, 'the_course_meta' ) );
      remove_action( 'sensei_course_content_inside_before', array( Sensei()->course, 'course_image' ), 30, 1 );
      remove_action( 'sensei_course_content_inside_before', array( 'Sensei_Templates', 'the_title' ), 5, 1 );
    
      add_action( 'sensei_course_content_inside_before', array( Sensei()->course, 'the_course_meta' ), 10 );
      add_action( 'sensei_course_content_inside_before', array( Sensei()->course, 'course_image' ), 20 );
      add_action( 'sensei_course_content_inside_before', array( 'Sensei_Templates', 'the_title' ), 30 );
    }
    
    add_action( 'init', 'reorder_course_archive_details' );

    Hope that helps.

    Plugin Contributor Dan

    (@drawmyface)

    I’m marking this as resolved since it’s been over 2 weeks with no response. If you still need help with this, please feel free to mark it ‘not resolved’ again.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.