• Hi,
    i’m using this code:

    <div style="position: relative; width: 100%;">
    
    <a style="color: #fff; font: 32px 'Open Sans', Arial, Helvetica, sans-serif; font-weight: bold;" href="post-permalink"><img src="image-url" alt="" />
    <div style="position: absolute; bottom: -1px; background: linear-gradient(to top, rgba(0,0,0,0.8),rgba(0,0,0,0)); padding: 1.4% 4% 1.4% 4%;">post-title</div>
    </a></div>

    to get something like this:
    https://i64.tinypic.com/33w7fxe.jpg

    the thing is that i have to add the permalink, the image URL and the post title manually how can i make it pull automatically the latest post permalink+image+title Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The Image URL for what? Which image?

    Permalink:
    echo get_permalink( $post->ID );

    Post Title:
    echo get_the_title();

    Thread Starter bimmerime

    (@bimmerime)

    Hi,
    thanks for the reply
    the image should be the featured image of that post
    also i tried what you suggested but it did not change anything

    If you’re trying to enter into the page editor (dashboard) then it will never work – there is no way to do it without a plugin or development.

    If you enter it into the template, it will work.

    Featured image: here is something I’ve used

    if ( has_post_thumbnail() ) {
    	global $post;
    	$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
    	echo "\t".'<img width="1500" height="790" src="'.$image[0].'" class="home-hero-image wp-post-image" alt="home-main-image"/>'."\n";
    }
    Thread Starter bimmerime

    (@bimmerime)

    Thanks but how can i implement it with my code?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How can i get the last post permalink image title’ is closed to new replies.