Skip to content

Instantly share code, notes, and snippets.

View nanoanno's full-sized avatar

Anno Pohl nanoanno

View GitHub Profile
@nanoanno
nanoanno / gist:9733309fe61ce1ce1f1c38a2a09104d4
Last active August 29, 2017 16:34
Book By Owner - Locations - Testimonial
<?php
if( have_rows('loc_testimonials') ) :
?>
<h2>Testimonials</h2>
<div class="bbo-columns">
<?php
while( have_rows('loc_testimonials') ) : the_row();
echo '<div class="bbo-column">';
@nanoanno
nanoanno / twenty-nineteen-custom-color-override
Last active April 17, 2019 08:28
Twenty-Nineteen Custom Color Override
/*
* Set background for:
* - featured image :before
* - featured image :before
* - post thumbmail :before
* - post thumbmail :before
* - Submenu
* - Sticky Post
* - buttons
* - WP Block Button
@nanoanno
nanoanno / get_acf_image_with_alt
Last active March 26, 2021 21:08
Get ACF image with alt text (and add classes)
// Load in ACF image with alt text
function get_acf_image_with_alt( $imagefield, $postID, $imagesize = 'full', $subfield = false, $class = '' ) {
if ( $subfield == true ) {
$imageID = get_sub_field( $imagefield, $postID );
}
else {
$imageID = get_field( $imagefield, $postID );
}
$image = wp_get_attachment_image_src( $imageID, $imagesize );
$alt_text = get_post_meta( $imageID , '_wp_attachment_image_alt', true );
@nanoanno
nanoanno / get_acf_image_with_alt-example.html
Created March 29, 2021 20:56
An example of using the get_acf_image_with_alt function
<a class="member" href="<?php the_permalink(); ?>">
<?php echo get_acf_image_with_alt( 'serious_photo', get_the_ID(), 'team-member', false, 'serious-photo' ); ?>
<?php echo get_acf_image_with_alt( 'funny_photo', get_the_ID(), 'team-member', false, 'funny-photo' ); ?>
<p class="name"><?php the_title(); ?></p>
<p class="title"><?php the_field( 'team_page_title' ); ?></p>
</a>