‘includes’ not retrieving files
-
Can anyone explain why this might not be working? The files being included contain lists of regions for each country concerned. The first one works, returning a list of counties in England on the page in question. The second one for the USA does not return the expected list of states. The code below is in a file called taxonomy-location.php.
<?php if (is_tax( 'location', 'england' )) { ?> <?php include('includes/df-location-england.php'); ?> <?php } elseif (is_tax( 'location', 'usa' )) { ?> <?php include('includes/df-location-usa.php'); ?> <?php } elseif (is_tax( 'location', 'wales' )) { ?> <?php include('includes/df-location-wales.php'); ?> <?php } elseif (is_tax( 'location', 'scotland' )) { ?> <?php include('includes/df-location-scotland.php'); ?> <?php } elseif (is_tax( 'location', 'northern-ireland' )) { ?> <?php include('includes/df-location-northern-ireland.php'); ?> <?php } ?>
As an example, here is the code in df-location-england.php:
<?php //list terms in a given taxonomy using wp_list_categories (also useful as a widget if using a PHP Code plugin) $taxonomy = 'location'; $orderby = 'name'; $show_count = 0; // 1 for yes, 0 for no $pad_counts = 0; // 1 for yes, 0 for no $hierarchical = 1; // 1 for yes, 0 for no $title = ''; $child_of = '167'; $args = array( 'taxonomy' => $taxonomy, 'orderby' => $orderby, 'show_count' => $show_count, 'pad_counts' => $pad_counts, 'hierarchical' => $hierarchical, 'title_li' => $title, 'child_of' => $child_of ); ?> <ul class="location"> <?php wp_list_categories( $args ); ?> </ul>
The only difference in the USA version of this file is that the child_of ID changes to match the USA, thereby excluding the parent ID from the list.
Any advice appeciated.
- The topic ‘‘includes’ not retrieving files’ is closed to new replies.