Removing ACF front end dependency
|
<?php |
|
$gallery = get_post_meta( get_the_ID(), 'home_slider'); // 'home_slider' is name of my ACF gallery field |
|
$image_ids = $gallery[0]; // It's an array within an array |
|
|
|
// If we have some images loop around and populate a new data array |
|
if( is_array( $image_ids )) { |
|
$image_ids_string = implode( ',', $image_ids ); // Soliloquy Dynamic requires image IDs to be passed as a comma separated list |
|
echo '<div class="gallery-slider">'; |
|
soliloquy_dynamic( array( |
|
'id' => 'gallery-images', |
|
'images' => $image_ids_string, |
|
'animate' => 'true' |
|
) ); |
|
echo '</div>'; |
|
} |
|
<?php |
|
|
|
$gallery = get_post_meta( get_the_ID(), 'gallery' ); // 'gallery' is name of my ACF gallery field |
|
if( is_array( $gallery[0] )) { |
|
$image_ids = $gallery[0]; |
|
$shortcode = '[gallery columns="3" link="none" size="large" ids="' . implode(',', $image_ids) . '"]'; // build your gallery shortcode |
|
echo do_shortcode( $shortcode ); |
|
} |
|
<?php |
|
$bg_image = get_post_meta( get_the_ID(), 'hero', true );// 'hero' is name of my ACF gallery field |
|
$image_url = wp_get_attachment_url( $bg_image ); //get the image url |
|
|
|
if ( $bg_image ) { |
|
echo '<section class="hero-section" style="background-image:url('.$image_url.'); background-repeat:no-repeat;"> |
|
</div">'; |
|
} |
|
<?php |
|
|
|
$url = esc_url( get_post_meta( get_the_ID(), 'my_url', true )); //'my_url' is name of my ACF url field |
|
if ($url) { |
|
echo '<a href="'.$url. '" class="button">Visit Link</a>'; |
|
} |
|
<?php |
|
$mycontent = wpautop (get_post_meta( get_the_ID(), 'test_wysiwyg', true )); // 'test_wysiwyg' is name of my ACF wysiwyg field |
|
if ($mycontent) { |
|
echo '<div class="row">' . $mycontent . '</div>'; |
|
} |
|
<?php |
|
$location = wpautop (get_post_meta( get_the_ID(),'location', true)); |
|
$location = apply_filters('the_content', $location); //Apply filter to initiate shortcodes |
|
if ( $location ) { |
|
echo '<div class="location-map">' . $location. '</div>'; |
|
} |