Support » Themes and Templates » can't get featured image url using get_post_meta

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

    I am having the same problem.. I want to use the featured image URL, but I don’t want to dive into all the mess to get it.

    I think I am going to use the hack I came up with. Its not pretty but it gets the job done:

                echo $matches[0] [0];


    I think this works better:

    $featured_img=explode('www', get_attached_file(get_post_thumbnail_id()));
    $featured_img=get_bloginfo('url') . $featured_img[1];

    Execute the code inside the loop.

    if you have something like this:

    add_theme_support( 'post-thumbnails' );
    	set_post_thumbnail_size( 226, 135 );
    	add_image_size( 'gallery-link', 96, 60, true ); gallerie

    you can use inside your loop:

    <!-- get url for thumbnail gallery-link -->
    <?php $galleryurl = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'gallery-link' ); ?>

    and use it like this:
    <a href="<?php echo $galleryurl[0]; ?>" > link </a>

    Hi misthero,

    The code did the work , thanks man.

    @misthero thank you very much


    I am using a WP theme that has featured tabs
    ( those 3 grey tabs show featured content, but the featured image on those tabs comes from the wodpress featured image.

    I want the featured image to come from a get_post_meta like the tab tittle, but i am not sure on how to chnage the code… can anyone help me?

    $arr[$i]["tabtitle"] = get_post_meta($post->ID, 'Tab', $single = true);
    		$arr[$i]["permalink"] = get_permalink();
    		$arr[$i]["thumbnail"] = get_thumbnail($width,$height,'thumbnail alignleft',$arr[$i]["fulltitle"],$arr[$i]["tabtitle"]);
    		$arr[$i]["thumb"] = $arr[$i]["thumbnail"]["thumb"];
    		$arr[$i]["use_timthumb"] = $arr[$i]["thumbnail"]["use_timthumb"];
    		$ids[]= $post->ID;
    	endwhile; wp_reset_query();	?>
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘can't get featured image url using get_post_meta’ is closed to new replies.