From 24c7466f384b85d85940a48d8d90720af9056d44 Mon Sep 17 00:00:00 2001 From: shrimp2t Date: Mon, 21 Nov 2022 15:25:48 +0700 Subject: [PATCH] Add image size #443 --- inc/template-tags.php | 17 +-- section-parts/section-news.php | 245 ++++++++++++++++---------------- section-parts/section-team.php | 4 +- template-parts/content-list.php | 2 +- 4 files changed, 136 insertions(+), 132 deletions(-) diff --git a/inc/template-tags.php b/inc/template-tags.php index 854020b..890d2e8 100644 --- a/inc/template-tags.php +++ b/inc/template-tags.php @@ -1324,22 +1324,22 @@ function onepress_get_section_gallery_data() { $post = get_post( $post_id ); if ( $post ) { $img_thumb = wp_get_attachment_image_src( $post_id, $image_thumb_size ); - if ( $img_thumb ) { - $img_thumb = $img_thumb[0]; - } + $img_full = wp_get_attachment_image_src( $post_id, 'full' ); - if ( $img_full ) { - $img_full = $img_full[0]; - } + $alt = get_post_meta( $post_id, '_wp_attachment_image_alt', true ); if ( $img_thumb && $img_full ) { $data[ $post_id ] = array( 'id' => $post_id, - 'thumbnail' => $img_thumb, - 'full' => $img_full, + 'thumbnail' => $img_thumb[0], + 'thumb_w' => $img_thumb[1], + 'thumb_h' => $img_thumb[2], + 'full' => $img_full[0], + 'full_w' => $img_full[1], + 'full_h' => $img_full[2], 'title' => $post->post_title, 'content' => $post->post_content, 'alt' => $alt, @@ -1460,6 +1460,7 @@ function onepress_gallery_generate( $echo = true ) { if ( $col <= 0 ) { $col = 4; } + switch ( $display_type ) { case 'masonry': $html = onepress_gallery_html( $data ); diff --git a/section-parts/section-news.php b/section-parts/section-news.php index d97750b..3da5d49 100644 --- a/section-parts/section-news.php +++ b/section-parts/section-news.php @@ -1,141 +1,144 @@ - -
class=""> - - -
- -
- ' . esc_html( $subtitle ) . '';} ?> - ' . esc_html( $title ) . '';} ?> - ' . apply_filters( 'onepress_the_content', wp_kses_post( $desc ) ) . '
'; -} ?> -
+if (!$disable) : + + $title = get_theme_mod('onepress_news_title', esc_html__('Latest News', 'onepress')); + $subtitle = get_theme_mod('onepress_news_subtitle', esc_html__('Section subtitle', 'onepress')); + $number = absint(get_theme_mod('onepress_news_number', '3')); + $more_page = get_theme_mod('onepress_news_more_page', ''); + $more_link = get_theme_mod('onepress_news_more_link', ''); + $more_text = get_theme_mod('onepress_news_more_text', esc_html__('Read Our Blog', 'onepress')); + $desc = get_theme_mod('onepress_news_desc'); + +?> + +
class=""> -
-
-
-
- $number, - 'suppress_filters' => 0, - ); - if ( $cat > 0 ) { - $args['category__in'] = array( $cat ); - } - - if ( $orderby && $orderby != 'default' ) { - $args['orderby'] = $orderby; - } - - if ( $order ) { - $args['order'] = $order; - } - - $query = new WP_Query( $args ); - - ?> - have_posts() ) : ?> - - - have_posts() ) : - $query->the_post(); ?> - +
+ +
+ ' . esc_html($subtitle) . ''; + } ?> + ' . esc_html($title) . ''; + } ?> + ' . apply_filters('onepress_the_content', wp_kses_post($desc)) . '
'; + } ?> +
+ +
+
+
+
+ $number, + 'suppress_filters' => 0, + ); + if ($cat > 0) { + $args['category__in'] = array($cat); + } + + if ($orderby && $orderby != 'default') { + $args['orderby'] = $orderby; + } + + if ($order) { + $args['order'] = $order; + } + + $query = new WP_Query($args); + + ?> + have_posts()) : ?> + + + have_posts()) : + $query->the_post(); ?> + - - - - - + + + + + post_title; + } + } + } + + if (!$link) { + $link = $more_link; + } + + if (!$label) { + $label = $more_text; + } + + if ($link != '' && $label != '') { + ?> +
+ +
+ - -if ( $hide_meta ) { - onepress_loop_remove_prop( 'show_meta' ); -} - - onepress_loop_remove_prop( 'excerpt_length' ); - onepress_loop_remove_prop( 'excerpt_type' ); - - $link = ''; - $label = ''; - -if ( $more_page ) { - $page = get_post( $more_page ); - if ( $page ) { - $link = get_permalink( $page ); - if ( ! $more_text ) { - $label = $page->post_title; - } - } -} - -if ( ! $link ) { - $link = $more_link; -} - -if ( ! $label ) { - $label = $more_text; -} - -if ( $link != '' && $label != '' ) { - ?> -
-
- -
-
+
-
- - -
+ + +
- <?php echo $image_alt; ?> + <?php echo $image_alt; ?> diff --git a/template-parts/content-list.php b/template-parts/content-list.php index 0341f19..129c8e8 100644 --- a/template-parts/content-list.php +++ b/template-parts/content-list.php @@ -23,7 +23,7 @@ if ( has_post_thumbnail() ) { the_post_thumbnail( 'onepress-blog-small' ); } else { - echo ''; + echo ''; } ?>