• Resolved scylderon

    (@scylderon)


    Is it possible, using a custom template, to call a posts’s thumbnail to add it to the listing?

    I’ve tried this on my own, but it seems I’m missing something, because it does nothing to call the post thumbnail in the item loop.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Dani Llewellyn

    (@diddledani)

    Yes this is possible. There is a template file in the plugin directory at wp-content/plugins/a-z-listing/templates/a-z-listing.php. Copy this into your theme or child theme’s root folder (wp-content/themes/<yourtheme>/a-z-listing.php) and customise to suit. You will want to focus on the code that looks like this on lines 22 to 26:

    <?php while ( $a_z_query->have_items() ) : $a_z_query->the_item(); ?>
      <li>
        <a href="<?php $a_z_query->the_permalink(); ?>"><?php $a_z_query->the_title(); ?></a>
      </li>
    <?php endwhile; ?>

    The code as it is above prints a list-item tag, with the post’s title linked to the post via an anchor tag. You could, for example, add the thumbnail using the_post_thumbnail() to the beginning of the link by amending these lines to read:

    <?php while ( $a_z_query->have_items() ) : $a_z_query->the_item(); ?>
      <li>
        <a href="<?php $a_z_query->the_permalink(); ?>">
          <?php the_post_thumbnail( 'thumbnail' ); ?>
          <?php $a_z_query->the_title(); ?>
        </a>
      </li>
    <?php endwhile; ?>
    Thread Starter scylderon

    (@scylderon)

    Thanks. I had already tried that and had no luck. I had used the multi-column template initially, and the columns in that template didn’t work. Tried it again with this specific code and the default template, and no luck.

    Tried then disabling all other plugins; didn’t work.
    Reverted to the default WP theme; didn’t work.

    All plugins and WP version are up to date.

    The templating system was working, which I tested with just adding some text into the custom template – that showed up fine.

    But as far as I can tell, after a bunch of testing, something is fundamentally flawed in this plugin and it will ONLY output information in the default format; nothing more.

    Plugin Author Dani Llewellyn

    (@diddledani)

    Achievement unlocked: you found a bug 🙂

    The next version (1.6.2) will include a fix which should be available for download any time now once ww.wp.xz.cn’s systems kick into gear and update the package.

    Thanks for spotting the problem.

    Plugin Author Dani Llewellyn

    (@diddledani)

    I’ve marked this as resolved, but please come back if you want or need further discourse or assistance.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Adding thumbnails to each item’ is closed to new replies.