Search
 
SCRIPT & CODE EXAMPLE
 

PHP

wordpress featured image as a background image

<?php
  	if ( has_post_thumbnail() ) {
    	$image_b1 = get_the_post_thumbnail_url();
  	}
	else {
  		$image_b1 = get_stylesheet_directory_uri().'/images/noimage.png';
	}
?>
  
 <div style="background-image: url(<?php echo $image_b1; ?>);">
Comment

PREVIOUS NEXT
Code Example
Php :: find type in php 
Php :: run php server 
Php :: php mysql date format 
Php :: laravel collection flatten 
Php :: php clean html tags 
Php :: wp get user meta 
Php :: php convert words with spaces to camelcase 
Php :: how to allow cors through header in php 
Php :: get option field acf 
Php :: max execution time exceeded php 
Php :: ubuntu 18.04 php is not working 
Php :: laravel eloquent search query 2020 
Php :: get the current page id in wordpress 
Php :: php mysql create table 
Php :: php get all txt files in directory 
Php :: composer memory limit 
Php :: encryption key has not encrypted laravel 
Php :: laravel delete confirm link 
Php :: php discord webhook 
Php :: php create file html 
Php :: php get first and last day of previous month 
Php :: wordpress on publish hook 
Php :: laravel collection filter 
Php :: laravel eloquent merge request 
Php :: carbon set locale laravel 
Php :: get post title by post id wordpress 
Php :: wordpress check if page 
Php :: how to escape html tags in php 
Php :: ubuntu php7.4-curl : Depends: libcurl3 (= 7.44.0) but it is not going to be installed E: Unable to correct problems, you have held broken packages. 
Php :: array to stdclass object php 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =