Support » Plugin: A-Z Listing » Plugin updated and now custom template not working

  • Hi, there.

    I’ve successfully been using your plugin for a glossary index, where glossary items are a custom post type. I used a custom template for the a-z listing to control the number of columns and to add the post type content.
    So, I added

    echo the_content();

    within the item loop.

    Like I said, this has been working great, you can see it here:

    BUT, I just updated your plugin (to version 3.1.0) among others at a staging site and this one bit of functionality from the custom template is gone. I can still tell the custom template is being used because I made some other edits to test. However, the_content, is no longer being shown.

    I tried substituting the_title and it works fine. But the_excerpt or the_content shows nothing.

    Do you have any idea why this would be after an update?
    I’m happy to provide the staging url (and password to review) to show the problem but I’d rather do so privately.

    Thanks for any insight. I’m happy to provide more details.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Daniel Llewellyn


    It depends which version you updated from, but versions after 2.0.0 do not load the whole post into the server’s RAM when building the listing. You need to load the post object into memory to be able to use the_content or the_excerpt because this is not included in the data that the plugin normally loads. You can force the loading of post objects into memory by adding the following line to your template after $a_z_query->the_item();, which in the current template is on line 54:

    $a_z_query->get_the_item_object( 'I understand the issues!' );

    Note the text passed as the parameter I understand the issues! must read exactly that to tell the plugin that you understand that doing this may result in the page loading slowly or failing to load at all if you have a large number of posts to show. This problem is because it takes a lot of database queries to load all the posts and also memory will be incrementally allocated as each post is loaded without being freed until the request is complete or fails.

    Thank you so much for your reply, Daniel. My template does indeed include that line.

    This is what that section of my custom template looks like. This was your base, all I added was the_content.

    <ul class="columns <?php echo $column_class; ?>">
    	while ( $a_z_query->have_items() ) :
    	$a_z_query->get_the_item_object( 'I understand the issues!' );
    	<a>the_permalink(); ?>">
    	<?php $a_z_query->the_title(); ?>
    	<?php echo  the_content(); ?>
    	<?php endwhile; ?>

    Like I said, this worked just fine (shown in the link I posted before). I made no changes other than updating all my plugins. I went from your plugin’s 2.1.4 to the latest.

    If the above looks correct, could there be anything I’m missing that would have interfered with this from one version to the next?

    • This reply was modified 1 year, 1 month ago by spark_1.
    • This reply was modified 1 year, 1 month ago by spark_1.
    • This reply was modified 1 year, 1 month ago by spark_1.

    UPDATE – still need some insight!

    I did further testing and if I choose “posts” as the post type in the shortcode, the_content is pulled in successfully by the template.

    However, it is not working for custom post types…

    I have two on the site, “glossary” as I showed in the link in my original post and one other. I have tried both for testing and the A-Z listing shows the title, but not the_content for either of these.

    So, my custom A-Z template is still “working” but suddenly not for custom post types.

    Any thoughts?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Plugin updated and now custom template not working’ is closed to new replies.