WordPress.org

Ready to get started?Download WordPress

Forums

ColorWay
Display multiple images on blog page instead of a single one only (2 posts)

  1. luftikus143
    Member
    Posted 2 years ago #

    Hi there,

    when using the blog template, the theme is displaying only the last image of any blog entry, instead of using all images.

    The code which generates this one-image-only is in the file "inkthemes-functions.php", and looks like this:

    /*-----------------------------------------------------------------------------------*/
    /* Function to call first uploaded image in functions file
    /*-----------------------------------------------------------------------------------*/
    function inkthemes_main_image() {
      global $post, $posts;
      //This is required to set to Null
      $id='';
      $the_title='';
      // Till Here
      $permalink = get_permalink( $id );
      $homeLink = get_template_directory_uri();
      $first_img = '';
      ob_start();
      ob_end_clean();
      $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
      if(isset($matches [1] [0])){
      $first_img = $matches [1] [0];}
      if(empty($first_img)){ //Defines a default image
      }
      else{
      print "<a href='$permalink'><img src='$first_img' width='640px' height='400px' class='postimg wp-post-image' alt='$the_title' /></a>";
    }
    }

    I can program a bit in PHP, but am no expert. Here, it just calls for the last image in the blog entry code. Is there any way to call and get the result for all images?

    Thanks for any hints!

    http://wordpress.org/extend/themes/colorway/

  2. luftikus143
    Member
    Posted 2 years ago #

    Hello,

    no one can help me? How can I change the template so that not only one out of several photos of any article will be displayed on my blog page?

    Thanks for any hints!

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic