Jump to content

[WordPress]Having a problem echo'ing an href....


Jim R

Recommended Posts

I linked the test page for the code below.  It's producing the functional results I want, but the list bullets are askew and, as you will see, it's just printing the URL not producing a hyperlink. 

 

http://hoosierhoopsreport.com/test.php

 

$mf_query = <<<EOF
    SELECT t.*, tt.*, p.*
    FROM {$wpdb->posts} as p, {$wpdb->term_relationships} as tr, {$wpdb->terms} AS t, {$wpdb->term_taxonomy} AS tt
    WHERE tt.`taxonomy` = 'series'
    AND t.`term_id` = tt.`term_id`
    AND tr.`object_id` = p.`ID`
    AND tt.`term_taxonomy_id` = tr.`term_taxonomy_id`
    AND tt.`count` > 0
    GROUP BY t.`term_id`
    ORDER BY p.`post_date` DESC 
LIMIT 5
EOF;

$mf_terms = $wpdb->get_results( $mf_query );


if( !empty( $mf_terms ) ) {
    
    foreach ( $mf_terms as $mf_term  ) {


	 $loop = new WP_Query( array( 'series' => $mf_term->slug ) ); 
		if ( $loop->have_posts() ) : 

		echo '<b>' . $mf_term->name . '</b>'; 

		echo '<ul>';

			while ( $loop->have_posts() ) : $loop->the_post(); 
				echo '<li><a href="' . the_permalink() . '">' . the_title() . '</a></li>';
			endwhile; wp_reset_query(); 

		echo '</ul>';

		endif;

	}		


}  

Link to comment
Share on other sites

I literally just figured it out.  I added get_ in front of the_permalink and the_title. 

 

This is kind of stuff that makes me thankful I don't code for a living.  This took me a whole day, as it was producing the values I wanted, just not in hyperlink form.  I tried another href statement, and it worked just fine. 

 

Not sure if it applies to my problem, but I read something in WordPress that the_title strips out the HTML attributes.  Then it said something like See Also:  get_the_title.  I tried it.  It worked.  :)

 

 

Thanks for looking at it though.  I was a little worried it would be overlooked after it was moved.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.