G

loop

public
Guest Oct 15, 2024 Never 11
Clone
Plaintext paste1.txt 76 lines (67 loc) | 2.77 KB
1
<?php
2
// Support custom "anchor" values.
3
$anchor = '';
4
if ( ! empty( $block['anchor'] ) ) {
5
$anchor = 'id="' . esc_attr( $block['anchor'] ) . '" ';
6
}
7
// Create class attribute allowing for custom "className" and "align" values.
8
$class_name = 'all-vignerons ';
9
if ( ! empty( $block['className'] ) ) {
10
$class_name .= ' ' . $block['className'];
11
}
12
if ( ! empty( $block['align'] ) ) {
13
$class_name .= ' align' . $block['align'];
14
}
15
?>
16
<?php
17
if(! is_admin() ):
18
?>
19
<div id="vignerons" <?php echo $anchor; ?> class="<?php echo esc_attr( $class_name ); ?> ">
20
<h2 class="title_vignerons"><?php _e( 'Portrait de nos vignerons ', 'damnit' ); ?></h2>
21
22
<div class="liste_vignerons facetwp-template">
23
24
<?php //echo do_shortcode('[facetwp facet="appellation"]'); ?>
25
<?php
26
$argsBlog = array(
27
'post_type' => 'vigneron',
28
'post_status' => 'publish',
29
'order' => 'ASC',
30
// 'posts_per_page' => 9,
31
'orderby' => 'title',
32
'ignore_sticky_posts' => true,
33
// "facetwp" => true
34
);
35
$my_queryBlog = new WP_Query( $argsBlog );
36
?>
37
38
39
<?php if( $my_queryBlog->have_posts() ) : while( $my_queryBlog->have_posts() ) : $my_queryBlog->the_post();
40
?>
41
42
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
43
<header class="entry-header">
44
<?php the_title( '<h3 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h3>' ); ?>
45
</header><!-- .entry-header -->
46
<?php if ( has_post_thumbnail() ) {
47
the_post_thumbnail();
48
} else {
49
echo '<img src="' . get_bloginfo( 'stylesheet_directory' ) . '/img/thumbnail-default.jpg" />';
50
}
51
?>
52
53
<div class="entry-content">
54
<?php the_excerpt(); ?>
55
</div><!-- .entry-content -->
56
<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
57
<div class="wp-block-button">
58
<a href="<?php echo esc_url( get_permalink() ); ?>" class="wp-block-button__link has-noir-color has-blanc-background-color has-text-color has-background has-link-color wp-element-button"><?php _e( 'En savoir plus', 'damnit' ); ?> </a>
59
</div>
60
</div>
61
62
</article><!-- #post-<?php the_ID(); ?> -->
63
64
<?php
65
endwhile;
66
endif;
67
wp_reset_postdata();
68
?>
69
<?php echo do_shortcode(' [facetwp facet="load_more"]'); ?>
70
</div>
71
72
</div>
73
<?php else: ?>
74
<div class="blogContent" >
75
<h5>Affichage des vignerons avec filtres. Veuillez faire vos modifications dans la rubrique "Vignerons"</h5></div>
76
<?php endif; ?>