Changeset 2270322
- Timestamp:
- 03/29/2020 06:25:00 PM (6 years ago)
- Location:
- simple-course-creator/trunk
- Files:
-
- 4 edited
-
assets/css/admin-style.css (modified) (1 diff)
-
includes/admin/class-scc-settings-page.php (modified) (7 diffs)
-
includes/scc_templates/scc-output.php (modified) (4 diffs)
-
includes/scc_templates/scc.css (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
simple-course-creator/trunk/assets/css/admin-style.css
r893716 r2270322 4 4 } 5 5 .wp-people-group { 6 margin-top: 0;6 margin-top: 4px; 7 7 } 8 8 .wp-person { -
simple-course-creator/trunk/includes/admin/class-scc-settings-page.php
r1443528 r2270322 54 54 55 55 // add option for ordering posts 56 add_settings_field( 'scc_orderby', __( 'Order Posts By', 'scc'), array( $this, 'course_orderby' ), 'simple_course_creator', 'course_display_settings' ); 56 add_settings_field( 'scc_orderby', __( 'Sort Posts By', 'scc'), array( $this, 'course_orderby' ), 'simple_course_creator', 'course_display_settings' ); 57 58 // add option for ordering posts ASC or DESC 59 add_settings_field( 'scc_order', __( 'Order Posts', 'scc'), array( $this, 'course_order' ), 'simple_course_creator', 'course_display_settings' ); 57 60 58 61 // add option for choosing current post text/font properties … … 86 89 $options = wp_parse_args( $options, $default ); 87 90 88 // possible course positionoptions91 // possible list options 89 92 $course_container = array( 90 93 'above' => array( 'value' => 'above', 'desc' => __( 'Above Content', 'scc' ) ), … … 116 119 $options = wp_parse_args( $options, $default ); 117 120 118 // possible list styleoptions121 // possible list options 119 122 $list_type = array( 120 123 'ordered' => array( 'value' => 'ordered', 'desc' => __( 'Numbered List', 'scc' ) ), … … 145 148 $options = wp_parse_args( $options, $default ); 146 149 147 // possible list styleoptions150 // possible list options 148 151 $orderby = array( 149 152 'date' => array( 'value' => 'date', 'desc' => __( 'Date', 'scc' ) ), … … 160 163 <?php } ?> 161 164 </select> 162 <label><?php _e( 'Choose how to order to order your post listing.', 'scc' ); ?></label> 165 <label><?php _e( 'Choose a parameter for ordering your post listing.', 'scc' ); ?></label> 166 <?php 167 } 168 169 170 /** 171 * course order ASC or DESC 172 * 173 * @callback_for 'scc_order' field 174 */ 175 public function course_order() { 176 177 // set default option value 178 $default = array( 'scc_order' => 'ASC' ); 179 $options = get_option( 'course_display_settings', $default ); 180 $options = wp_parse_args( $options, $default ); 181 182 // possible list options 183 $order = array( 184 'asc' => array( 'value' => 'asc', 'desc' => __( 'Ascending', 'scc' ) ), 185 'desc' => array( 'value' => 'desc', 'desc' => __( 'Descending', 'scc' ) ), 186 ); 187 ?> 188 <select id="scc_order" name="course_display_settings[scc_order]"> 189 <?php foreach ( $order as $o ) { // display options from $order array ?> 190 <option value="<?php echo $o['value']; ?>" <?php selected( $options['scc_order'], $o['value'] ); ?>><?php echo $o['desc']; ?></option> 191 <?php } ?> 192 </select> 193 <label><?php _e( 'Choose whether your list should be in ascending or descending order.', 'scc' ); ?></label> 163 194 <?php 164 195 } … … 178 209 $options = wp_parse_args( $options, $default ); 179 210 180 // possible list styleoptions211 // possible list options 181 212 $current_post = array( 182 213 'none' => array( 'value' => 'none', 'desc' => __( 'No Style', 'scc' ) ), … … 241 272 } else { 242 273 update_option( 'scc_orderby', $input['scc_orderby'] ); 274 } 275 276 // validate the order option 277 if ( ! isset( $input['scc_order'] ) ) { 278 $input['scc_order'] = 'ASC'; 279 } else { 280 update_option( 'scc_order', $input['scc_order'] ); 243 281 } 244 282 -
simple-course-creator/trunk/includes/scc_templates/scc-output.php
r1443528 r2270322 7 7 // get/set the option values 8 8 $default_options = array( 9 'display_position' => 'above', 10 'list_type' => 'ordered', 11 'scc_orderby' => 'date', 12 'current_post' => 'none', 13 'disable_js' => 0, 9 'display_position' => 'above', 10 'list_type' => 'ordered', 11 'scc_orderby' => 'date', 12 'scc_order' => 'ASC', 13 'current_post' => 'none', 14 'disable_js' => 0, 14 15 ); 15 $options = get_option( 'course_display_settings', $default_options );16 $options = wp_parse_args( $options, $default_options );16 $options = get_option( 'course_display_settings', $default_options ); 17 $options = wp_parse_args( $options, $default_options ); 17 18 18 19 // build the post listing based on course 19 $the_posts = get_posts( array(20 $the_posts = get_posts( array( 20 21 'post_type' => 'post', 21 22 'posts_per_page' => -1, … … 23 24 'no_found_rows' => true, 24 25 'orderby' => $options['scc_orderby'], 25 'order' => apply_filters( 'scc_order', 'ASC' ),26 'order' => $options['scc_order'], 26 27 'tax_query' => array( 27 28 array( 'taxonomy' => 'course', 'field' => 'slug', 'terms' => $course->slug ) 28 29 ) ) ); 30 29 31 $course_toggle = apply_filters( 'course_toggle', __( 'full course', 'scc' ) ); 30 $posts = 1; 32 $posts = 1; 33 31 34 foreach ( $the_posts as $post_id ) { 32 35 if ( $post_id == $post->ID ) break; $posts ++; 33 36 } 34 $array = get_option( 'taxonomy_' . $course->term_id ); 35 $post_list_title = $array['post_list_title']; 37 38 $array = get_option( 'taxonomy_' . $course->term_id ); 39 $post_list_title = $array['post_list_title']; 36 40 $course_description = term_description( $course->term_id, 'course' ); 37 $list_container = $options['list_type'] == 'ordered' ? 'ol' : 'ul'; 38 $no_list = $options['list_type'] == 'none' ? 'style="list-style: none;"' : ''; 41 $list_container = $options['list_type'] == 'ordered' ? 'ol' : 'ul'; 42 $no_list = $options['list_type'] == 'none' ? 'style="list-style: none;"' : ''; 43 39 44 switch ( $options['current_post'] ) { 40 45 case 'bold': … … 79 84 * add_filter( 'course_toggle', 'your_filter_name' ); 80 85 */ 81 ?>82 86 83 <?phpif ( is_single() && sizeof( $the_posts ) > 1 ) :87 if ( is_single() && sizeof( $the_posts ) > 1 ) : 84 88 do_action( 'scc_before_container' ); 85 89 ?> … … 132 136 </div> 133 137 <?php do_action( 'scc_container_bottom' ); ?> 134 </div> 135 <?php138 </div><!-- #scc-wrap --> 139 <?php 136 140 do_action( 'scc_after_container' ); 137 141 endif; -
simple-course-creator/trunk/includes/scc_templates/scc.css
r919556 r2270322 1 1 /** 2 * To edit, create a folder called "scc_templates" in the root of your theme 2 * To edit, create a folder called "scc_templates" in the root of your theme 3 3 * and COPY this file into it. It will override the plugin's CSS file. 4 4 */ … … 7 7 #scc-wrap { 8 8 position: relative; 9 padding: 1em; 10 border: 1px solid #dadada; 11 margin: 0 0 1.5em; 9 padding: 1em 0 1.4em; 10 border-width: 2px 0; 11 border-style: dotted; 12 border-color: rgba(0,0,0,.1); 13 margin-bottom: 1.5em; 12 14 } 13 15 #scc-wrap .scc-post-container { … … 44 46 #scc-wrap .scc-toggle-post-list { 45 47 position: absolute; 46 right: 10px;47 bottom: 2px;48 right: 0; 49 bottom: 10px; 48 50 font-size: 10px; 49 51 font-weight: bold;
Note: See TracChangeset
for help on using the changeset viewer.