Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

get_term_link is Ending to single.php WordPress

  • REFUNDED

I have a template like this:

<strong>page-movie.php
taxonomy-movieTax.php
taxonomy.php</strong>
and I am using the get_term_link() at page-movie.php to list and link from the indexed page into List of all Custom Post Types under that term in taxonomy-movie.php but this is ending in single.php page when user click on one of the listed terms!

<?php
$tax = 'movieTax';
$args = array(
'hide_empty' => false,
'orderby' => 'name',
'order' => 'ASC'
);
$tax_terms = get_terms($tax, $args);
foreach ($tax_terms as $tax_term) {
echo '<li>' . '<a href="' . esc_attr(get_term_link($tax_term, $taxonomy)) . '" title="' . sprintf( __( "View all posts in %s" ), $tax_term->name ) . '" ' . '>' . $tax_term->name. '(' . $tax_term->count .')' .'</a></li>';
}
?>

This was working fine for me untill few hours ago and I just tried to fix on issue on counting the CPT's under tax term by adding this ti Taxonomy regiter function:

'update_count_callback' => '_update_post_term_count',
'query_var' => true,
and after that the links ended on single.php! Then I removed the added code but still getting same issue!

Answers (2)

2014-10-24

timDesain Nanang answers:

pleas take a look this: http://codex.wordpress.org/images/1/18/Template_Hierarchy.png

try to create
<strong>archive-movie.php</strong> to display the archive of movie custom post type
<strong>single-movie.php</strong> to display the single post of movie custom post type


Behseini comments:

HI Tim but I do not want to create a Single!


timDesain Nanang comments:

if the taxonomy name is movieTax,
then taxonomy-movie.php <strong>should be taxonomy-movieTax.php</strong>
to list all movies under selected taxonomy


Behseini comments:

as a matter of fact it is! o you have a Teamviewr to take a look at me code?

2014-10-24

Arnav Joy answers:

if you have undone all the changes you made and it still not working , then please try to reset your permalink and see if that works.