Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

Nagytalp on "Display custom taxonomy part as "label on image" @home"

$
0
0

Hi!

I have this code:

< ?php
$p_terms = get_the_terms( $post->ID , 'tagportfolio' );
print_r($p_terms);
if ( $p_terms && ! is_wp_error( $p_terms ) ) {
$term_links = array();
foreach ( $p_terms as $p_term ) {
$term_links[] = $p_term->name;
}
$termslinks = join( ", ", $term_links );
echo '
'.$termslinks.'

';
}
?>

I wanna show the name of the custom taxonomy on the featured image on my home page as a clickable label. This code is works and the solution is inside of the but I don't know where.

At this moment the result look like this:

Array ( [6] => stdClass Object ( [term_id] => 6 [name] => Allegro [slug] => allegro [term_group] => 0 [term_taxonomy_id] => 45 [taxonomy] => tagportfolio [description] => Zene-bona [parent] => 0 [count] => 5 [object_id] => 1342 [filter] => raw ) ) Allegro

What I need is the last word! In this case the "Allegro".

And if can anybody tell me the perfect code for the solution then how can I style this label?

Another problem is in this case: When mouse over on this "result" the whole picture flashes extremly fast.

My site is here: http://www.irodalmibableves.hu

Thank You!


Viewing all articles
Browse latest Browse all 8245

Trending Articles