Search
 
SCRIPT & CODE EXAMPLE
 

PHP

get featured image post wordpress by post id

<?php if (has_post_thumbnail( $post->ID ) ): ?>
  <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
  <div id="custom-bg" style="background-image: url('<?php echo $image[0]; ?>')">

  </div>
<?php endif; ?>
Comment

wordpress featured image show

<?php echo the_post_thumbnail(); ?>
Comment

get featured image id wordpress

get_post_thumbnail_id($post) 
Comment

wordpress get post featured image

//default 
$image_url = wp_get_attachment_url(1234);
// change if post have feature image
if (has_post_thumbnail($recent_post['ID'])) {
	$image_url = wp_get_attachment_url(get_post_thumbnail_id($recent_post['ID']), '');
}
Comment

show featured image in post wordpress

<?php if(has_post_thumbnail()){
  the_post_thumnbail('cstm_name', array( 'class' => 'class1 class2' ))
} else { ?>
  <img class="card-img-top" src="http://placehold.it/750x300" alt="Card image cap" class="img-responsive">
<?php } ?>
Comment

PREVIOUS NEXT
Code Example
Php :: http_response_code 
Php :: php loop 100 times 
Php :: api response in json laravel 
Php :: convert string to float in php 
Php :: add execute time php 
Php :: symfony set content type 
Php :: change the date format in laravel view page 
Php :: get_the_category() 
Php :: format date laravel timestamp view 
Php :: mac brew install php redis 
Php :: php code for video upload 
Php :: laravel database seeder medium 
Php :: laravel collection pipe 
Php :: laravel Service Unavailable 
Php :: get post info in php 
Php :: insert key-value pair into array php 
Php :: foreach ph 
Php :: password_verify() php 
Php :: loop iteration laravel 
Php :: array key value php 
Php :: laravel append parameter to links 
Php :: reply to wp_mail 
Php :: laravel collection split 
Php :: laravel relation select fields 
Php :: define int variable in php 
Php :: redirect stderr from echo 
Php :: wordpress image size name 
Php :: greater than or equal to in php 
Php :: laravel realation with has 
Php :: multiple submit button in php 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =