Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 04-26-2020, 01:21 AM   #1
hausarzt
Confirmed User
 
hausarzt's Avatar
 
Industry Role:
Join Date: Jan 2011
Location: Somewhere in Germany
Posts: 817
Need help with one line if php/html

Hey folks.
I want to add an extra line of code to my wordpress site, but I can't fgure out the correct code. Maybe someone can help me?

Every post has a featured image. I want to add a line of code, to that the the direct link to the featured image appears as a link in the theme.
Must be something like

Code:
<a href='$postthumbnail-whatever-url' title='$thumbnail-title-or-so' target="_blank">CLICK HERE</a>
Any helpers?
__________________
I know, my english is bad. But your german might be even worse
hausarzt is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-26-2020, 06:57 AM   #2
zerovic
Confirmed User
 
zerovic's Avatar
 
Industry Role:
Join Date: Apr 2010
Posts: 1,084
Try it like this
Quote:
<a href='<?php echo $postthumbnail; ?>-whatever-url' title='<?php echo $thumbnail; ?>-title-or-so' target="_blank">CLICK HERE</a>
zerovic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-26-2020, 08:23 AM   #3
hausarzt
Confirmed User
 
hausarzt's Avatar
 
Industry Role:
Join Date: Jan 2011
Location: Somewhere in Germany
Posts: 817
If you mean this
Code:
<a href='<?php echo $postthumbnail; ?>' title='<?php echo $thumbnail; ?>' target="_blank">CLICK HERE</a>
the answer is no.
This code points to the post-url. A need to point it to the post-thumbnail-url.
But we are getting closer.
__________________
I know, my english is bad. But your german might be even worse
hausarzt is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-28-2020, 11:18 AM   #4
machinegunkelly
Confirmed User
 
machinegunkelly's Avatar
 
Join Date: Jun 2003
Posts: 3,276
// outside the loop
Code:
    $post = get_post(99);
    $thumb_url = get_the_post_thumbnail_url($post->ID,'full'); 

    echo '<a href="'.esc_url($thumb_url).'">Click Here</a>';
// inside the WP loop

Code:
    while ( have_posts() ) {
        the_post(); 
        $thumb_url = get_the_post_thumbnail_url(get_the_ID(),'full'); 
        echo '<a href="'.esc_url($thumb_url).'">Click here</a>';
    endwhile;
__________________
dead.
machinegunkelly is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks

Tags
code, line, add, link, image, featured, appears, post, direct, click, helpers, theme, correct, folks, extra, hey, php/html, wordpress, site, fgure



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.