Inversing terms of attribute [migrated]

I got an issue.

I got a list of artists as an attribute.

I made this code to show it on a page:

$terms = get_terms( ‘pa_artists’ );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
echo ‘<ul class=”artistes”>’;
foreach ( $terms as $term ) {
echo ‘<li><a href=”‘ . get_term_link( $term ) . ‘” title=”‘ . sprintf( __( ‘View all post filed under %s’, ‘my_localization_domain’ ), $term->name ) . ‘”>’ . $term->name . ‘</a></li>’;

echo ‘</ul>’;

So far so good…

But i created the attributes like this:

Pablo Picasso
Paul Gauguin
Auguste Renoir

But i need to reverse the order of the words…
To show it like this: (And if possible the first word in bold)

RENOIR Auguste

I tried to make an explode string to do it, but couldn’t make it work.

Any idea?

Read more here:: Inversing terms of attribute [migrated]

Leave a Reply

Your email address will not be published. Required fields are marked *