Created
May 5, 2020 21:38
-
-
Save jonschr/8e01dccd6c88fc4656e57a8fda258bc9 to your computer and use it in GitHub Desktop.
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 | |
//* Output services before | |
// add_action( 'before_loop_layout_services_photo', 'rb_services_photo_before' ); | |
function rb_services_photo_before( $args ) { | |
// wp_enqueue_script( 'SCRIPTHANDLE' ); | |
} | |
//* Output each services | |
add_action( 'add_loop_layout_services_photo', 'rb_services_photo_each' ); | |
function rb_services_photo_each() { | |
//* Global vars | |
global $post; | |
$id = get_the_ID(); | |
//* Vars | |
$title = get_the_title(); | |
$permalink = get_the_permalink(); | |
$content = get_the_content(); | |
//* Markup | |
if ( $content ) | |
printf( '<a href="%s" class="featured-image" style="background-image:url( %s )"></a>', $permalink, get_the_post_thumbnail_url( $id, 'large' ) ); | |
if ( !$content ) | |
printf( '<div class="featured-image" style="background-image:url( %s )"></div>', get_the_post_thumbnail_url( $id, 'large' ) ); | |
if ( $title ) { | |
if ( $content ) | |
printf( '<h3><a href="%s">%s</a></h3>', $permalink, $title ); | |
if ( !$content ) | |
printf( '<h3>%s</h3>', $title ); | |
} | |
edit_post_link(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment