get_option( 'orderby' ); $options = [ 'date' => __( 'Date', 'themify-event-post' ), 'event_date' => __( 'Event Date', 'themify-event-post' ), 'id' => __( 'ID', 'themify-event-post' ), 'author' => __( 'Author', 'themify-event-post' ), 'title' => __( 'Title', 'themify-event-post' ), 'name' => __( 'Name', 'themify-event-post' ), 'modified' => __( 'Modified Date', 'themify-event-post' ), 'rand' => __( 'Random', 'themify-event-post' ), 'comment_count' => __( 'Comments Count', 'themify-event-post' ), ]; echo ''; } public function order() { $value = Themify_Event_Post::get_instance()->get_option( 'order' ); $options = [ 'desc' => __( 'Descending', 'themify-event-post' ), 'asc' => __( 'Ascending', 'themify-event-post' ), ]; echo ''; } public function layout() { $value = Themify_Event_Post::get_instance()->get_option( 'layout', 'grid2' ); $options = [ 'list-post' => __( '1 Column Grid', 'themify-event-post' ), 'grid2' => __( '2 Columns Grid', 'themify-event-post' ), 'grid3' => __( '3 Columns Grid', 'themify-event-post' ), 'grid4' => __( '4 Columns Grid', 'themify-event-post' ), ]; echo ''; } public function show() { $value = Themify_Event_Post::get_instance()->get_option( 'show' ); $options = [ 'all' => __( 'All Events', 'themify-event-post' ), 'upcoming' => __( 'Upcoming Events', 'themify-event-post' ), 'past' => __( 'Past Events', 'themify-event-post' ), ]; echo ''; } public function google_maps_key_callback() { $value = Themify_Event_Post::get_instance()->get_option( 'google_maps_key' ); printf( '', esc_attr($value) ); printf( '

' . __( 'Generate an API key and insert it here. This is required for displaying the event location on a map.', 'themify-event-post' ) . '

'); } public function single_permalink_callback() { $value = Themify_Event_Post::get_instance()->get_option( 'single_permalink', 'event' ); printf( '', esc_attr($value) ); } public function category_permalink_callback() { $value = Themify_Event_Post::get_instance()->get_option( 'category_permalink', 'event-category' ); printf( '', esc_attr($value) ); } public function currency() { $value = Themify_Event_Post::get_instance()->get_option( 'currency' ); printf( '', esc_attr($value) ); } public function currency_pos() { $value = Themify_Event_Post::get_instance()->get_option( 'currency_pos', 'right_space' ); $options = [ 'left' => __( 'Left', 'themify-event-post' ), 'right' => __( 'Right', 'themify-event-post' ), 'left_space' => __( 'Left with space', 'themify-event-post' ), 'right_space' => __( 'Right with space', 'themify-event-post' ), ]; echo ''; } /** * Callback for after plugin's options are saved * * Resets the permalinks to save new rewrite slug * * @since 1.0.0 */ function updated_option( $option_name, $old_value, $value ) { if ( $option_name === 'themify_event_post' ) { /* re-register the post type to set the new rewrite slug */ themify_event_post_register_post_type(); /* flush permalinks to save the new rewrite slug */ flush_rewrite_rules(); } } /** * Display an additional column in list * @param array * @return array */ function type_column_header( $columns ) { unset( $columns['date'] ); $columns['icon'] = __( 'Image', 'themify-event-post' ); $columns['event_date'] = __( 'Event Date', 'themify-event-post' ); $columns['shortcode'] = __( 'Shortcode', 'themify-event-post' ); return $columns; } /** * Display shortcode, type, size and color in columns in tiles list * @param string $column key * @param number $post_id * @return string */ function type_column( $column, $post_id ) { switch ( $column ) { case 'shortcode': echo '[themify_event_post id="' . $post_id . '"]'; break; case 'event_date': themify_event_post_date(); break; case 'icon' : $image = ''; if ( has_post_thumbnail( $post_id ) ) { $img = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), 'thumbnail' ); if ( isset( $img[0] ) ) { $image = ''; } } echo ! empty( $image ) ? $image : __( 'No Featured Media', 'themify-event-post' ); break; } } /** * Select form element to filter the post list * @return string HTML */ public function get_select() { global $typenow; if ( 'event' !== $typenow ) { return; } $html = ''; foreach ( ['event-category', 'event-tag'] as $tax) { $options = sprintf('', __('View All', 'themify-event-post'), get_taxonomy($tax)->label); $class = is_taxonomy_hierarchical($tax) ? ' class="level-0"' : ''; foreach (get_terms( $tax ) as $taxon) { $options .= sprintf('', isset($_GET[$tax]) ? selected($taxon->slug, $_GET[$tax], false) : '', '0' !== $taxon->parent ? ' class="level-1"' : $class, $taxon->slug, '0' !== $taxon->parent ? str_repeat(' ', 3) : '', "{$taxon->name} ({$taxon->count})"); } $html .= sprintf('', $tax, $tax, $options); } return print $html; } }