'; //$classes = $content_select . ' ' . $classes; $output ='
'; if ( $title || $sub_title ) { $output .='
'; if ( '' !== $title ) { $output .='

' . wp_kses_post( $title ) . '

'; } if ( $sub_title ) { $output .='

' . wp_kses_post( $sub_title ) . '

'; } $output .='
'; } $output .='
'; //$classes = $content_select . ' ' . $layout; // Select content if ( 'demo' === $content_select ) { $output .= audioman_demo_events(); } elseif ( 'post' === $content_select || 'page' === $content_select || 'category' === $content_select ) { $output .= audioman_post_page_category_events(); } elseif ( 'custom' === $content_select ) { $output .= audioman_custom_events(); } $target = get_theme_mod( 'audioman_events_target' ) ? '_blank': '_self'; $link = get_theme_mod( 'audioman_events_link', '#' ); $text = get_theme_mod( 'audioman_events_text', esc_html__( 'View More', 'audioman' ) ); $output .='
'; if ( $text ) { $output .= '

' . esc_html( $text ) . '

'; } $output .='
'; echo $output; } } endif; if ( ! function_exists( 'audioman_demo_events' ) ) : /** * Display Demo Events * * @since Audioman 1.0 * */ function audioman_demo_events() { return '

Nawalparasi, Nepal

Kumaripati, Lalitpur

Nawalparasi, Nepal

Lollapalooza Brasil
'; } endif; // audioman_demo_events if ( ! function_exists( 'audioman_post_page_category_events' ) ) : /** * Display Page/Post/Category Events * * @since Audioman 1.0 */ function audioman_post_page_category_events() { global $post; $quantity = get_theme_mod( 'audioman_events_number', 4 ); $no_of_post = 0; // for number of posts $post_list = array();// list of valid post/page ids $type = get_theme_mod( 'audioman_events_type', 'demo' ); $output = ''; $args = array( 'post_type' => 'any', 'orderby' => 'post__in', 'ignore_sticky_posts' => 1 // ignore sticky posts ); //Get valid number of posts if ( 'post' == $type || 'page' == $type ) { for( $i = 1; $i <= $quantity; $i++ ){ $post_id = ''; if ( 'post' == $type ) { $post_id = get_theme_mod( 'audioman_events_post_' . $i ); } elseif ( 'page' == $type ) { $post_id = get_theme_mod( 'audioman_events_page_' . $i ) ; } if ( $post_id ) { if ( class_exists( 'Polylang' ) ) { $post_id = pll_get_post( $post_id, pll_current_language() ); } $post_list = array_merge( $post_list, array( $post_id ) ); $no_of_post++; } } $args['post__in'] = $post_list; } elseif ( 'category' == $type ) { $no_of_post = $quantity; if ( get_theme_mod( 'audioman_events_select_category' ) ) { $args['category__in'] = (array) get_theme_mod( 'audioman_events_select_category' ); } $args['post_type'] = 'post'; } if ( 0 == $no_of_post ) { return; } $args['posts_per_page'] = $no_of_post; $loop = new WP_Query( $args ); while ( $loop->have_posts() ) { $loop->the_post(); $title_attribute = the_title_attribute( 'echo=0' ); $output .= '
'; if ( ! get_theme_mod( 'audioman_events_hide_date' ) ) { $event_date_day = get_the_date( 'j' ); $event_date_month = get_the_date( 'M' ); $event_date_day_meta = get_post_meta( $post->ID, 'audioman-event-date-day', true ); $event_date_month_meta = get_post_meta( $post->ID, 'audioman-event-date-month', true ); if ( '' !== $event_date_day_meta ) { $event_date_day = $event_date_day_meta; } if ( '' !== $event_date_month_meta ) { $event_date_month = $event_date_month_meta; } $output .= ''; } $output .= '
'; if ( get_theme_mod( 'audioman_events_enable_title' ) ) { $output .= '

' . the_title( '','', false ) . '

'; } $content = apply_filters( 'the_content', get_the_content() ); $content = str_replace( ']]>', ']]>', $content ); $output .= '
' . wp_kses_post( $content ) . '
'; $output .= '
'; $text = get_theme_mod( 'audioman_events_individual_text_' . absint( $loop->current_post + 1 ) ); $output .= ' ' . esc_html( $text ) . '
'; } //endwhile wp_reset_postdata(); return $output; } endif; // audioman_post_page_category_events if ( ! function_exists( 'audioman_custom_events' ) ) : /** * Display Custom Events * * @since Audioman 1.0 */ function audioman_custom_events() { $quantity = get_theme_mod( 'audioman_events_number', 4 ); $output = ''; for ( $i = 1; $i <= $quantity; $i++ ) { $target = get_theme_mod( 'audioman_events_target_' . $i ) ? '_blank' : '_self'; $link = get_theme_mod( 'audioman_events_link_' . $i, '#' ); //support qTranslate plugin if ( function_exists( 'qtrans_convertURL' ) ) { $link = qtrans_convertURL( $link ); } $title = get_theme_mod( 'audioman_events_title_' . $i ); if ( class_exists( 'Polylang' ) ) { $title = pll__( $title ); } $date_day = get_theme_mod( 'audioman_events_date_day_' . $i ); $date_month = get_theme_mod( 'audioman_events_date_month_' . $i ); if ( $date_month ) { // Convert 1 to Jan, 2 to Feb and so on $date_month = date( 'M', mktime(0, 0, 0, $date_month, 10 ) ); } $output .= '
'; if ( $date_day || $date_month ) { $output .= ''; } $content = get_theme_mod( 'audioman_events_content_' . $i ); if ( $title || $content ) { $output .= '
'; } if ( $title ) { $output .= '

' . wp_kses_post( $title ) . '

'; } if ( $content ) { $output .= '

' . $content . '

'; } if ( $title || $content ) { $output .= '
'; } $text = get_theme_mod( 'audioman_events_individual_text_' . $i ); if ( $text ) { $output .= ' ' . esc_html( $text ) . ''; } $output .= '
'; } return $output; } endif; //audioman_custom_events