-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
84 lines (55 loc) · 1.51 KB
/
functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
/**
** Ajouter le CSS du theme parent
**/
add_action( 'wp_enqueue_scripts', 'deppo_slmn_enqueue_styles', 11 );
function deppo_slmn_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
/**
* Fonction modifiée pour afficher les images d'ACF
* On utilise ACF pour charger l'image.
* Le champ s'appelle:
* image_accueil
*
* @since deppo 1.0
*/
function deppo_slmn_slider_featured_image() {
if ( has_post_thumbnail() ) :
?>
<div class="featured-content featured-image <?php echo esc_attr( deppo_get_featured_image_class() ); ?>">
<?php
$display_post_nav = get_theme_mod( 'display-slider-settings', 1 );
switch ( $display_post_nav ) {
case 0:
$classes[] = 'slider-text-side';
break;
default:
$classes[] = 'slider-text-center';
}
$url = wp_get_attachment_url( get_post_thumbnail_id( ) );
$filetype = wp_check_filetype($url);
if ($filetype['ext'] == 'gif') {
$thumb_size = '';
} else {
$thumb_size = 'full';
}
if ( $display_post_nav == 0 ) { ?>
<a href="<?php the_permalink(); ?>">
<?php }
// vérifier si on a une image ACF:
$acf_image = get_field('image_accueil');
if( $acf_image ) {
echo wp_get_attachment_image( $acf_image['id'], $thumb_size );
} else {
the_post_thumbnail($thumb_size);
}
if ( $display_post_nav == 0 ) { ?>
</a>
<?php } ?>
</div>
<?php
else :
return;
endif;
}