WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Help in a function (3 posts)

  1. xuso_pg
    Member
    Posted 3 years ago #

    Hi, I need extract a data into a function but i cant.
    My code is:

    function fb_like_thumbnails()
    {
    global $posts;
    $default = 'http://www.vidalowcost.com/wp-content/themes/Elements/img/logo_face.png';
    $content = get_post_meta($post->ID, "cuadrado", true);

    if (is_single()) {
    $thumb = $content;
    }
    else
    $thumb = $default;

    echo "<link rel=\"image_src\" href=\"$thumb\" />
    }

    The bold text is the problem donĀ“t return nothing, and I need this value, because is my select image for the singles posts.

    Can you helpme? thanks

  2. alchymyth
    Forum Moderator
    Posted 3 years ago #

    try global $post;
    instead global $posts;

  3. xuso_pg
    Member
    Posted 3 years ago #

    YES! THANKS!

Topic Closed

This topic has been closed to new replies.

About this Topic