• samzdrav

    (@samzdrav)


    I have a WordPress installation on my local machine, and I was using this tutorial http://tympanus.net/Tutorials/ShapeHoverEffectSVG/index2.html to try and display custom posts. Here is the code I am using.

    <a href="#" data-path-hover="m 0,0 0,47.7775 c 24.580441,3.12569 55.897012,-8.199417 90,-8.199417 34.10299,0 65.41956,11.325107 90,8.199417 L 180,0 z">
       <figure>
          <img src="<?php bloginfo('template_url'); ?>/img/6.png" />
    	 <svg viewBox="0 0 180 320" preserveAspectRatio="none"><path d="m 0,0 0,171.14385 c 24.580441,15.47138 55.897012,24.75772 90,24.75772 34.10299,0 65.41956,-9.28634 90,-24.75772 L 180,0 0,0 z"/></svg>
    	  <figcaption>
                 <h2><?php the_title(); ?></h2>
    	     <p></p>
                 <button onclick="location.href='<?php the_permalink(); ?>'">More</button>
               </figcaption>
         </figure>
    </a>

    This way I see all the other info and the image displayed, but when i try to replace that image with the post featured image with <?php the_post_thumbnail();?> i get nothing in the browser. I tried other functions but i just got as far to show this <img src> in the browser. Somehow the php isn’t getting parsed. Any ideas how to display the post featured image?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Michael

    (@alchymyth)

    how are you getting the posts?

    are you using get_posts() or WP_Query()?

    what is the full code of the template?

    Thread Starter samzdrav

    (@samzdrav)

    the posts are from this loop <?php while(have_posts()): the_post(); ?> in a custom category-actor.php file

    webdesignerchristian

    (@webdesignerchristian)

    also recode to this
    <img src=”<?php $imgurl = get_the_post_thumbnail();echo $imgurl; ?>”>

    had problem with images showing up in the header once, which led me to believe that the img tag wasnt controlling the image. so doing this resolved my issue.

    Thread Starter samzdrav

    (@samzdrav)

    No it’s not working. I tried and the browser shows <img src>. I also tried getting the featured image url but with no luck.

    Michael

    (@alchymyth)

    does the featured image for any of the posts show anywhere else in your site?

    what exactly do you mean with ‘custom posts’?
    is that custom post types?

    have you set the featured image when you edit or create the post?

    note:
    as far as I can see, your ‘tutorial’ link does not really shown any useful tutorial.

    Thread Starter samzdrav

    (@samzdrav)

    Yes, the featured images do show everywhere else on the site, they don’t show only here. I have a custom post type Actor and the featured image is set. And the tutorial isn’t about WordPress, I just wanted to see if I can use the hover effects from the tutorial and create a nice posts listing.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘the_post_thumbnail not working’ is closed to new replies.