Re-order course notifications by date

I am using CoursePress Pro and we use the Notifications area to post updates about new lessons and general issues and info to our students. I'd like the most recent notification to be on top. Right now they are in a random order. Usually the most recent one is last, but not always. How can I order them by date?

  • Adam Czajczyk

    Hello Darla,

    I hope you're well today and thank you for your question!

    The notifications can be set to a "reverse" order (from newest to oldest) but it will require direct editing plugin's core files therefore it's not recommended and the patch would need to be applied after each plugin's update.

    If you're willing to give it a try please follow the steps below.

    1. Access your site via FTP (or cPanel "File Manager")
    2. Go to "/wp-content/plugins/coursepress/includes/classes/" folder
    3. Download the "class.shortcodes.php" file for backup purpose (in case anything went wrong)
    4. Edit original "class.shortcodes.php" file making following changes:

    - find line (around) #3178 where this code starts:

    $args = array(
    				'category'       => '',
    				'order'          => 'ASC',
    				'post_type'      => 'notifications',
    				'post_mime_type' => '',
    				'post_parent'    => '',
    				'post_status'    => 'publish',
    				'orderby'        => 'meta_value_num',
    				'posts_per_page' => '-1',
    				'meta_query'     => array(
    					'relation' => 'OR',
    						'key'   => 'course_id',
    						'value' => $course_id
    						'key'   => 'course_id',
    						'value' => ''

    - inside the code above replace line

    'order'          => 'ASC',


    'order'          => 'DESC',

    - and replace line

    'orderby'        => 'meta_value_num',


    'orderby'        => 'ID',

    After the file is saved notifications should always be sorted by post ID (which by default is a higher number for newer posts) in a reverse order (most recent on top).

    Best regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.