PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.10
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.10
4.4.10 4.4.9.1 4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 All 142 releases
← All changes | assets/src/apps/js/blocks/courses/course-order-by/edit.js +34 -34 4.3.9 → 4.4.10 View file →
@@ -1,34 +1,34 @@
1 -import { __ } from '@wordpress/i18n';
2 -import { useBlockProps } from '@wordpress/block-editor';
3 -export const edit = ( props ) => {
4 - const { attributes, setAttributes, context } = props;
5 - const blockProps = useBlockProps();
6 - const orderByValue = context.lpCourseQuery?.order_by || 'post_date';
7 - const orderByData = [
8 - { label: 'Newly published', value: 'post_date' },
9 - { label: 'Title a-z', value: 'post_title' },
10 - { label: 'Title z-a', value: 'post_title_desc' },
11 - { label: 'Price high to low', value: 'price' },
12 - { label: 'Price low to high', value: 'price_low' },
13 - { label: 'Popular', value: 'popular' },
14 - { label: 'Average Ratings', value: 'rating' },
15 - ];
16 -
17 - const orderByLabel =
18 - orderByData.find( ( item ) => item.value === orderByValue )?.label ??
19 - 'Newly published';
20 -
21 - return (
22 - <>
23 - <div { ...blockProps }>
24 - <div className="courses-order-by-wrapper">
25 - <select name="order_by" className="block-courses-order-by">
26 - <option selected="selected">
27 - { orderByLabel }
28 - </option>
29 - </select>
30 - </div>
31 - </div>
32 - </>
33 - );
34 -};
1 +import { __ } from '@wordpress/i18n';
2 +import { useBlockProps } from '@wordpress/block-editor';
3 +export const edit = ( props ) => {
4 + const { attributes, setAttributes, context } = props;
5 + const blockProps = useBlockProps();
6 + const orderByValue = context.lpCourseQuery?.order_by || 'post_date';
7 + const orderByData = [
8 + { label: 'Newly published', value: 'post_date' },
9 + { label: 'Title a-z', value: 'post_title' },
10 + { label: 'Title z-a', value: 'post_title_desc' },
11 + { label: 'Price high to low', value: 'price' },
12 + { label: 'Price low to high', value: 'price_low' },
13 + { label: 'Popular', value: 'popular' },
14 + { label: 'Average Ratings', value: 'rating' },
15 + ];
16 +
17 + const orderByLabel =
18 + orderByData.find( ( item ) => item.value === orderByValue )?.label ??
19 + 'Newly published';
20 +
21 + return (
22 + <>
23 + <div { ...blockProps }>
24 + <div className="courses-order-by-wrapper">
25 + <select name="order_by" className="block-courses-order-by">
26 + <option selected="selected">
27 + { orderByLabel }
28 + </option>
29 + </select>
30 + </div>
31 + </div>
32 + </>
33 + );
34 +};