Last active
March 8, 2023 17:31
-
-
Save cccamuseme/77f0b5c7e7c4a697a32b313a777bdc34 to your computer and use it in GitHub Desktop.
Custom Post Type Slider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$slider = new WP_Query(array( 'post_type' => 'project' ) ); | |
if( $slider->have_posts() ) : | |
while($slider->have_posts()) : | |
$slider->the_post(); | |
?> | |
<style type="text/css"> | |
.project-box { | |
background-image: url('<?php the_field('featured_image') ?>'); | |
} | |
.project-box:hover { | |
background-image: url('<?php the_field('featured_image_hover') ?>'); | |
} | |
</style> | |
<a class="project-link" href="<?php the_permalink(); ?>" rel="bookmark"><div class="project-box"><span class="tooltiptext"><?php the_title(); ?></span></div></a> | |
<?php | |
endwhile; | |
endif; | |
wp_reset_query(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment