WordPress.org

Ready to get started?Download WordPress

Forums

Rollover Themes List
Remove Symbol from Beginning and End of Tags (4 posts)

  1. markb1439
    Member
    Posted 3 years ago #

    Hi,

    I'm wondering if there's any way to remove the "|" from the beginning and end of the tags list?

    For example, instead of:

    Tags: | black | blue | white |

    How about:

    Tags: black | blue | white

    Thanks,

    Mark

  2. markb1439
    Member
    Posted 3 years ago #

    Okay, I figured out how to remove the first "|"...simple enough. But I have no idea how to remove the one at the end, since that is appended to each tag. I don't know enough PHP to create a conditional that omits it from the last one. :-(

  3. David Sader
    Member
    Plugin Author

    Posted 3 years ago #

    The current theme tags

    if ( $ct->tags ) :
    		echo '<p>'. __( 'Tags: ' );
    			$action_tags = array();
     		foreach ($ct->tags as $tag) {
     			$tag_link = add_query_arg( 'tag', $tag, '?page='.$_GET['page'] );
    			$action_tags[] = '<a href="'.$tag_link.'">'.$tag.'</a>';
    			}
    		echo implode ( ' | ', $action_tags ).'</p>';
    endif;

    and later in the theme list tags

    if ( $tags ) :
    		echo '<p>'. __( 'Tags: ' );
    			$action_tags = array();
     		foreach ($tags as $tag) {
     			$tag_link = add_query_arg( 'tag', $tag, '?page='.$_GET['page'] );
    			$action_tags[] = '<a href="'.$tag_link.'">'.$tag.'</a>';
    			}
    		echo implode ( ' | ', $action_tags ).'</p>';
    endif;
  4. markb1439
    Member
    Posted 3 years ago #

    Thanks again! It's refreshing to see a plugin that works as advertised, can easily be modified (with your help) to do additional things, and is supported actively!

    Thank you for all of this.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic