the_shortlink() returns default text string
-
I’ve created a $query returns an array of posts that meet a certain taxonomy parameter:
$control_query_params = array( 'post_type' => 'control', 'tax_query' => array( array( 'taxonomy' => 'control-group', 'field' => 'slug', 'terms' => $family ) ) ); //return $control_query_params; $query = new WP_Query( $control_query_params );
Immediately following this block, I use the_shortlink() function to output links to the posts like this:
$output = '<ul>'; if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); // do something $output .= the_shortlink($text = $the_title, $title = $the_title, $before = '<li>', $after = '</li>' ); } } else { // no posts found $output .= 'No posts found.'; } $output .= '</ul>'; return $output;
For some reason, this code returns a bulleted list of links, which link to the proper posts, and have a popup title with the post title, but the link text is the DEFAULT link text for the the_shortlink() function, like this:
<a href="#">This is the short link.</a>
So the title variable for the link displays the correct text ($the_title) but the text variable does not. Any idea why?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘the_shortlink() returns default text string’ is closed to new replies.