Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

evanpyrz on "Modification to Theme to Add Image Link"

$
0
0

Hi there,
I have a general working knowledge of PHP and HTML, but am fairly new to coding for WordPress. Hoping this topic doesn't seem too far-fetched for a forum. What I am trying to do is modify an existing theme I have, to add a URL to a post's image to the HTML rendered. I though I had made the correct modification, however, I am unable to get WordPress to set my $Img variable to the post's data.

This is what I have:

function cro_menuq_func( $atts ) {

    extract( $atts );

    $img = get_the_post_thumbnail( $post_id );
    $op = '<div class="quickiemenu">';

    if (isset($title) && $title != '') {
        $op .= '<a href="'. $img .'"><span class="quickietitle cro_accent">' . stripslashes($title)  . '</span></a>';
    }

    if (isset($desc) && $desc != '') {
       $op .= '<span class="quickiedesc">' . stripslashes($desc)  . '</span>';
    }

    if (isset($price) && $price != '') {
       $op .= '<span class="quickieprice cro_accent">' . stripslashes($price)  . '</span>';
    }

    $op .= '</div>';

    return $op;

}
add_shortcode( 'cro_menuq', 'cro_menuq_func' );

I've contacted the theme's developer as well, but they have yet to get back to me, so I wanted to see if someone on here saw something standing out to them.

I'd be happy to provide reference to this entire file if needed.

Thanks in advance,

Eric


Viewing all articles
Browse latest Browse all 8245

Trending Articles