• Resolved harmeetsinghs

    (@harmeetsinghs)


    hi every one

    i am just copy and paste the content in post content showing properly but in category page thumbnail image not showing. Please any one help me on this .
    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Revert to Twenty Thirteen theme and see if images appear on category pages.

    Thread Starter harmeetsinghs

    (@harmeetsinghs)

    Thanks krishna
    i am using below code

    function catch_that_image() {
      global $post, $posts;
      $first_img = '';
      ob_start();
      ob_end_clean();
      $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches );
      $first_img = $matches[1][0];
    
      if(empty($first_img)) {
        $first_img = "https://localhost/goodfood/wp-content/themes/twentyeleven/images/images.jpg";
      }
      return $first_img;
    }
    <?php if ( post_password_required() ) : ?>
    				<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?>
    
    			<?php else : ?>
    				<?php if ( get_the_post_thumbnail($post_id) != '' ) {
    
      echo '<a href="'; the_permalink(); echo '" class="thumbnail-wrapper">';
       the_post_thumbnail();
      echo '</a>';
    
    } else {
    
     echo '<a href="'; the_permalink(); echo '" class="thumbnail-wrapper">';
     echo '<img src="';
     echo catch_that_image();
     echo '" alt="" />';
     echo '</a>';
    
    }?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Images on category page not appears’ is closed to new replies.