Forum Replies Created

Viewing 1 replies (of 1 total)
  • guys please help
    want to remove top featured image from post

    <?php
    /**
    * The template for displaying posts for the Default Post Format
    *
    * @package CPMmagz
    *
    */
    ?>
    <?php
    //Get the alt and title of the image
    global $post;
    $post_thumbnail_id = get_post_thumbnail_id($post->ID);
    $attachment = get_post($post_thumbnail_id);
    if (! is_single()) {
    if (has_post_thumbnail()) :
    // If the post has thumbnail
    $image_id = get_post_thumbnail_id();
    $image_url = wp_get_attachment_image_src($image_id, ‘full’);
    $image_url1 = esc_url($image_url[0]);
    ?>

    <div class=”card-image valign-wrapper” style=”background-image: url(‘<?php echo esc_url( $image_url1 ); ?>’);” title=”<?php echo esc_attr($attachment->post_title); ?>” alt=”<?php echo esc_attr(get_post_meta($attachment->ID, ‘_wp_attachment_image_alt’, true));?>”>
    ” class=”fulla”>
    <span class=”card-title”><i class=”fa fa-pencil”></i></span>
    </div>

    <?php else : ?>
    <!– If the Post doesnot have any thumbnail –>
    <div class=”no-image card-image valign-wrapper”>
    ” class=”card-title”><i class=”fa fa-pencil”></i>
    </div>
    <?php endif;?>

    <?php } else {
    if (has_post_thumbnail($post->ID)):
    // If the post has thumbnail
    $image_id = get_post_thumbnail_id();
    $image_url = wp_get_attachment_image_src($image_id, ‘full’);
    $image_url1 = esc_url($image_url[0]);
    ?>

    <!– If the page is single display this block. –>
    <div class=”card-image valign-wrapper” style=”background-image: url(‘<?php echo esc_url( $image_url1 );?>’);”>
    <span class=”card-title”><i class=”fa fa-pencil”></i></span>
    </div>
    <?php else : ?>

    <!– If the Post doesnot have any thumbnail –>
    <div class=”no-image card-image valign-wrapper”>
    ” class=”card-title”><i class=”fa fa-pencil”></i>
    </div>
    <?php endif; ?>

    <?php } ?>

Viewing 1 replies (of 1 total)