WordPress.org

Forums

how to writte this properly to make it work [RESOLVED] (6 posts)

  1. jetonr
    Member
    Posted 5 years ago #

    I am using yarp with my custom template and im having problems defining the thumbnail i get a parse error with php. Please help

    $related_thumbnail = bloginfo('template_directory').'/thumb.php?src='.echo get_post_meta($post->ID, "image_value", $single = true). '&h=105&w=150&zc=1';

  2. alchymyth
    Forum Moderator
    Posted 5 years ago #

    get_bloginfo ?

  3. jetonr
    Member
    Posted 5 years ago #

    thnx for the quick reply alchymyth but even with that it doesn't work i think i have a porblem with proper ' " . in php

  4. alchymyth
    Forum Moderator
    Posted 5 years ago #

    didn't look close enough first time:
    as you are working with the strings, there should be no 'echo' in the code.

  5. jetonr
    Member
    Posted 5 years ago #

    can i replace the whole .echo get_post_meta($post->ID, "image_value", $single = true). with a key for example
    $my_key = echo get_post_meta($post->ID, "image_value", $single = true);
    and than put the key in src = $my_key

  6. jetonr
    Member
    Posted 5 years ago #

    It worked like this, thnx for help

    $img_src = get_post_meta($post->ID, "image_value", $single = true);
    $related_thumbnail = get_template_directory_uri().'/thumb.php?src='. $img_src .'&h=105&w=150&zc=1';

Topic Closed

This topic has been closed to new replies.

About this Topic