blog_layout() ) { wp_enqueue_script('jquery'); wp_enqueue_script('jquery-masonry'); } } /** * Filters */ public function filters() { if ( is_singular() || is_404() || ( class_exists( 'Woocommerce' ) && is_woocommerce() ) || ( class_exists( 'Tribe__Events__Main' ) && get_post_type() === 'tribe_events' ) ) { return; } $sidebar = get_theme_mod( 'sidebar_archives', 0 ); if ( ! $sidebar ) { add_filter( 'botiga_content_class', function() { return 'no-sidebar'; } ); add_filter( 'botiga_sidebar', '__return_false' ); } add_filter( 'post_class', array( $this, 'post_classes' ) ); } public function post_classes( $classes ) { $text_align = get_theme_mod( 'archive_text_align', 'center' ); $columns = get_theme_mod( 'archives_grid_columns', '3' ); $columns = 'col-lg-' . 12/$columns . ' col-md-' . 12/$columns; $classes[] = 'post-align-' . esc_attr( $text_align ); $vertical_align = get_theme_mod( 'archives_list_vertical_alignment', 'middle' ); $classes[] = 'post-vertical-align-' . esc_attr( $vertical_align ); if ( 'layout3' === $this->blog_layout() || 'layout5' === $this->blog_layout() ) { $classes[] = $columns; } else { $classes[] = 'col-md-12'; } return $classes; } /** * Blog layout */ public function blog_layout() { $layout = get_theme_mod( 'blog_layout', 'layout3' ); if( ! $layout || $layout === 'Right' ) { $layout = 'layout3'; } return $layout; } /** * Default meta elements */ public function default_meta_elements() { return array( 'post_date' ); } /** * Create the archive posts */ public function post_markup() { $layout = $this->blog_layout(); $image_placement = get_theme_mod( 'archive_list_image_placement', 'left' ); $meta_position = get_theme_mod( 'archive_meta_position', 'above-title' ); switch ( $layout ) { case 'layout3': case 'layout5': $this->post_image(); if ( 'above-title' === $meta_position ) { $this->post_meta(); } $this->post_title(); $this->post_excerpt(); if ( 'below-excerpt' === $meta_position ) { $this->post_meta(); } break; case 'layout1': $this->post_image(); if ( 'above-title' === $meta_position ) { $this->post_meta(); } $this->post_title(); $this->post_excerpt(); if ( 'below-excerpt' === $meta_position ) { $this->post_meta(); } break; case 'layout2': if ( 'above-title' === $meta_position ) { $this->post_meta(); } $this->post_title(); $this->post_image(); $this->post_excerpt(); if ( 'below-excerpt' === $meta_position ) { $this->post_meta(); } break; case 'layout4': case 'layout6': echo '
'; $this->post_image(); echo '
'; echo '
'; if ( 'above-title' === $meta_position ) { $this->post_meta(); } $this->post_title(); $this->post_excerpt(); if ( 'below-excerpt' === $meta_position ) { $this->post_meta(); } echo '
'; break; } } /** * Post image */ public function post_image() { botiga_post_thumbnail(); } /** * Post meta */ public function post_meta() { if ( in_array( get_post_format(), array( 'aside', 'status' ) ) ) { return; } $elements = get_theme_mod( 'archive_meta_elements', $this->default_meta_elements() ); $archive_meta_delimiter = get_theme_mod( 'archive_meta_delimiter', 'none' ); if ( 'post' !== get_post_type() || empty( $elements ) ) { return; } echo '
'; foreach( $elements as $element ) { call_user_func( array( $this, $element ) ); } echo '
'; } /** * Post title */ public function post_title() { if ( in_array( get_post_format(), array( 'aside', 'status' ) ) ) { return; } if ( in_array( get_post_format(), array( 'link' ) ) ) { $content_url = get_url_in_content( get_the_content() ); $post_url = ( ! empty( $content_url ) ) ? $content_url : get_permalink(); } else { $post_url = get_permalink(); } ?>
', '' ); ?>
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped the_content(); echo ''; } else { $excerpt = get_theme_mod( 'show_excerpt', 1 ); $read_more = get_theme_mod( 'read_more_link', 0 ); if ( !$excerpt ) { return; } echo '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped the_excerpt(); if ( $read_more ) { echo '' . esc_html__( 'Read more', 'botiga' ) . ''; } echo '
'; } } /** * Post date */ public function post_date() { botiga_posted_on(); } /** * Post author */ public function post_author() { botiga_posted_by(); } /** * Post categories */ public function post_categories() { botiga_post_categories(); } /** * Post comments */ public function post_comments() { botiga_entry_comments(); } } /** * Initialize class */ Botiga_Posts_Archive::get_instance(); endif;