WordPress.org

Support

Support » Plugins and Hacks » Get the Image » [Plugin: Get the Image] Echo => False seems not to work (WP 3.4)

[Plugin: Get the Image] Echo => False seems not to work (WP 3.4)

  • First of all: Great plugin Justin!

    However I have a problem with implementing it. Have a function where I call a custom post time, and I want get_the_image() to return the image in stead of printing it directly.

    This is my code:

    $output = '<ul>';
    $args = array( 'post_type' => 'plots', 'posts_per_page' => 10 );
      $loop = new WP_Query( $args );
      while ( $loop->have_posts() ) : $loop->the_post();
      $output .= '<li>';
      $output .=  get_the_image(array('echo' => 'false'));
      $output .= '<a href="';
      $output .=	get_permalink();
      $output .= '">';
      $output .=	get_the_title();
      $output .= '</a><br />'.get_the_excerpt().'</li>';
      endwhile;
    $output .= '</ul>';
    
    return $output;

    The thumbs are being shown, but unfortunately all together at the beginning of the page, and not as part of the unordered list where I want to have it. Am I doing something wrong or is it the plugin part of ‘echo’ => ‘false’?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Just wanted to say that I am seeing similar behavior.

    You might want to try:

    get_the_image(array('echo' => false ));

    that is, no quotes around false.

    In a previous version, I used code similar to this:

    get_the_image('echo=0');

    or

    get_the_image('echo=false');

    Now with the update, this echos the images incorrectly.

    I think this is because echo is actually set to a string — “0” or “false”, depending on syntax. The way $echo is checked in the code now, it must be set to a boolean (false).

    The correct syntax would seem to be:

    get_the_image(array('echo' => false ));

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Get the Image] Echo => False seems not to work (WP 3.4)’ is closed to new replies.
Skip to toolbar