Course Arhive default sort
-
Hi,
For the courses archive page, as a follow-on to adding sort capability, I now have an issue with the sort default, which is set to post_date. Not only do I not need this option, but I need to change the default to post_title (ASC). I can get rid of the option from the sort drop-down, but that has no effect on it as it just continues to sort this way labelled incorrectly.Here is the code that I think needs to be overridden:
public function html_order_by( string $default_value = 'post_date' ): string {
$html_wrapper = [
'<div class="courses-order-by-wrapper">' => '</div>',
];
$values = apply_filters(
'learn-press/courses/order-by/values',
[
'post_date' => esc_html__( 'Newly published', 'learnpress' ),
'post_title' => esc_html__( 'Title a-z', 'learnpress' ),
'post_title_desc' => esc_html__( 'Title z-a', 'learnpress' ),
'price' => esc_html__( 'Price high to low', 'learnpress' ),
'price_low' => esc_html__( 'Price low to high', 'learnpress' ),
'popular' => esc_html__( 'Popular', 'learnpress' ),
]
);
$content = '<select name="order_by" class="courses-order-by">';
foreach ( $values as $k => $v ) {
$content .= '<option value="' . $k . '" ' . selected( $default_value, $k, false ) . '>' . $v . '</option>';
}
$content .= '</select>';
//$content .= $default_value;
return Template::instance()->nest_elements( $html_wrapper, $content );
}located in this file: /wp-content/plugins/learnpress/inc/TemplateHooks/Course/ListCoursesTemplate.php. Even changing it here to post_title without the proper technique for child theming has no effect:
public function html_order_by( string $default_value = 'post_title' ): string {Can you shed some light on the proper technique for changing this default?
Thanks as always,
JohnThe page I need help with: [log in to see the link]
The topic ‘Course Arhive default sort’ is closed to new replies.