Skip to main content
fixed bad CSS
Source Link
mrben522
  • 1.7k
  • 1
  • 12
  • 17
<?php 

$id = get_the_ID();
if (has_post_thumbnail( $id ) ):
    $thumb = get_the_post_thumbnail_url($id, 'full'); 
elseif (tribe_event_featured_image( $id)): 
    $thumb = tribe_event_featured_image( $event_id, 'large', false, false ); 
else: 
    $thumb = get_template_directory_uri().'/images/background.jpg'; endif;?>
<body <?php body_class(); ?> style="background-image: url('<?php echo $thumb;?>'); nobackground-repeatsize: fixed">cover;">
?>

Also you don't actually need the elseif statement, tribe_event_featured_image is a wrapper for the post thumbnail image with some added wrapping html.

<?php 

$id = get_the_ID();
if (has_post_thumbnail( $id ) ):
    $thumb = get_the_post_thumbnail_url($id, 'full'); 
elseif (tribe_event_featured_image( $id)): 
    $thumb = tribe_event_featured_image( $event_id, 'large', false, false ); 
else: 
    $thumb = get_template_directory_uri().'/images/background.jpg'; endif;?>
<body <?php body_class(); ?> style="background-image: url('<?php echo $thumb;?>') no-repeat fixed">
?>

Also you don't actually need the elseif statement, tribe_event_featured_image is a wrapper for the post thumbnail image with some added wrapping html.

<?php 

$id = get_the_ID();
if (has_post_thumbnail( $id ) ):
    $thumb = get_the_post_thumbnail_url($id, 'full'); 
elseif (tribe_event_featured_image( $id)): 
    $thumb = tribe_event_featured_image( $event_id, 'large', false, false ); 
else: 
    $thumb = get_template_directory_uri().'/images/background.jpg'; endif;?>
<body <?php body_class(); ?> style="background-image: url('<?php echo $thumb;?>'); background-size: cover;">
?>

Also you don't actually need the elseif statement, tribe_event_featured_image is a wrapper for the post thumbnail image with some added wrapping html.

Source Link
mrben522
  • 1.7k
  • 1
  • 12
  • 17

<?php 

$id = get_the_ID();
if (has_post_thumbnail( $id ) ):
    $thumb = get_the_post_thumbnail_url($id, 'full'); 
elseif (tribe_event_featured_image( $id)): 
    $thumb = tribe_event_featured_image( $event_id, 'large', false, false ); 
else: 
    $thumb = get_template_directory_uri().'/images/background.jpg'; endif;?>
<body <?php body_class(); ?> style="background-image: url('<?php echo $thumb;?>') no-repeat fixed">
?>

Also you don't actually need the elseif statement, tribe_event_featured_image is a wrapper for the post thumbnail image with some added wrapping html.