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 :: laravel get first letter of each word 
Php :: Yii::app()-request-get yii1 
Php :: create livewire component 
Php :: get data based on date in laravel 
Php :: php check session status 
Php :: print hello world in php 
Php :: laravel delete file after download 
Php :: php program to find factorial of a number using function 
Php :: query php 
Php :: default value date symfony entity 
Php :: Laravel eloquent upserts 
Php :: paystack gateway integration laravel 
Php :: php replace first occurrence in string 
Php :: phpmyadmin reset auto_increment 
Php :: how to remove Website field from comments 
Php :: prettier with php 
Php :: Ways to write comments in PHP 
Php :: Determining if input is present in Laravel 
Php :: php artisan tinker PsyExceptionRuntimeException Unable to create PsySH runtime directory 
Php :: running a php project 
Php :: php add to existing associative array 
Php :: foreach skip current iteration 
Php :: laravel route only and except 
Php :: laravel auth without vue or bootstrap 
Php :: pdo close connection 
Php :: my vscode extension prettier doesnot work for php code 
Php :: remove certain haracters from a string php 
Php :: add custom page to wordpress 
Php :: if condition in smarty 
Php :: how to get attribute value in xml using php 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =