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

wp get post thumbnail

$img_url = wp_get_attachment_image_url(get_post_thumbnail_id(get_the_ID()), 'full');
<img src="<?PHP echo $img_url?> ">
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 :: search query in laravel 
Php :: str_replace smarty template 
Php :: php day of week full name 
Php :: laravel factory get foreign key 
Php :: php is defined 
Php :: jquery serialize php decode 
Php :: nginx 404 not found laravel 
Php :: number format without comma php 
Php :: symfony migration down 
Php :: php number format comma and decimal 
Php :: echo php 
Php :: php superglobals 
Php :: Display the image on the front end from category taxonomy 
Php :: laravel hasmany relationship 
Php :: php week of a date 
Php :: laravel detach 
Php :: laravel select multiple value in form edit 
Php :: php set title dynamically 
Php :: wp_query post by category taxonomy 
Php :: php autoload classes 
Php :: if session is empty laravel 
Php :: laravel eloquent relationships count 
Php :: merge array 
Php :: replace key in php 
Php :: laravel 8 query builder 
Php :: laravel carbon get day name 
Php :: post php 
Php :: laravel apiresource 
Php :: check if variable is set and not empty laravel 
Php :: check if value change laravel 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =