Thanks to your help I now have a fully working index with cross-references incorporated, and thought I would share my customized template in case anyone else wants to do something similar.
I set up two custom taxonomies (using PODS, but that shouldn’t make any difference). The first is ‘subject’, which has no custom fields and works like categories or tags. The second is ‘cross_reference’, with one custom field called ‘target_subjects’. For example, a cross-reference with the title ‘dunnock’ might have ‘garden birds’ in its target_subjects field.
Here is my a-z-listing.php template file; it is in the root of my theme folder. The customized section is indicated by comments.
<?php
/**
* Default multicolumn template for the A-Z Listing plugin
*
* This template will be given the variable <code>$a_z_query</code> which is an instance
* of <code>A_Z_Listing</code>.
*
* You can override this template by copying this file into your theme
* directory.
*
* @package a-z-listing
*/
/**
* This value indicates the number of posts to require before a second column
* is created. However, due to the design of web browsers, the posts will flow
* evenly between the available columns. E.g. if you have 11 items, a value of
* 10 here will create two columns with 6 items in the first column and 5 items
* in the second column.
*/
$_a_z_listing_minpercol = 10;
?>
<div id="az-tabs">
<div id="letters">
<div class="az-letters">
<?php $a_z_query->the_letters(); ?>
</div>
</div>
<?php if ( $a_z_query->have_letters() ) : ?>
<div id="az-slider">
<div id="inner-slider">
<?php
while ( $a_z_query->have_letters() ) :
$a_z_query->the_letter();
?>
<?php if ( $a_z_query->have_items() ) : ?>
<?php
$item_count = $a_z_query->get_the_letter_count();
$num_columns = ceil(
$item_count / $_a_z_listing_minpercol
);
?>
<div class="letter-section"
id="<?php $a_z_query->the_letter_id(); ?>">
<h2 class="letter-title">
<span>
<?php $a_z_query->the_letter_title(); ?>
</span>
</h2>
<?php $column_class = "max-$num_columns-columns"; ?>
<ul class="columns <?php echo $column_class; ?>">
<?php
while ( $a_z_query->have_items() ) :
$a_z_query->the_item();
?>
<li>
/** CUSTOMIZED CODE BEGINS */
<?php
$term = $a_z_query->get_the_item_object( 'I understand the issues!' );
if ( 'cross_reference' === $term->taxonomy ) : ?>
<?php $a_z_query->the_title(); ?>:<em> see </em>
<?php echo get_term_meta( $term->term_id, '', false )["target_subjects"][0] ; ?>
<?php else : ?>
<a href="<?php $a_z_query->the_permalink(); ?>">
<?php $a_z_query->the_title(); ?>
</a>
<?php endif ?>
/** CUSTOMIZED CODE ENDS */
</li>
<?php endwhile; ?>
</ul>
<div class="back-to-top">
<a href="#letters">
<?php _e( 'Back to top', 'a-z-listing' ); ?>
</a>
</div>
</div>
<?php
endif;
endwhile;
?>
</div>
</div>
</div>
<?php else : ?>
<p>
<?php
esc_html_e(
'There are no posts included in this index.',
'a-z-listing'
);
?>
</p>
<?php
endif;
-
This reply was modified 5 years, 5 months ago by pcgardner. Reason: Improved accuracy