WordPress.org

Ready to get started?Download WordPress

Forums

Simple Taxonomies
Bug in widget code when displaying as list (1 post)

  1. Paul Bearne
    Member
    Posted 3 years ago #

    Hi

    In this function you add a / to the start of the Href in
    echo '<li><a href="/'.$link.'">'.$term->name.'</a>';

    this is breaks the url as the $link contains http://....

    I fixed on site my change it to

    echo '<li><a href="'.$link.'">'.$term->name.'</a>';

    simple-taxonomies/simple-taxonomies.php

    function widget( $args, $instance ) {
    		extract( $args );
    		echo $before_widget;
    		$title = apply_filters('widget_title', $instance['title'] );
    		if ( $title ) {
    			echo $before_title . $title . $after_title;
    		}
    		if ( $instance['type'] == "cloud" ) {
    			wp_tag_cloud( array( 'taxonomy' => $instance['taxonomy'], 'number' => $instance['number'], 'order' => $instance['cloudorder'] ) );
    		} else {
    			$terms = get_terms( $instance['taxonomy'], 'number='.$instance['number'].'&order='.$instance['listorder'] );
    			echo '<ul class="taxonomylist">';
    			foreach ($terms as $term) {
    				$link = get_term_link( $term, $instance['taxonomy'] );
    				echo '<li><a href="/'.$link.'">'.$term->name.'</a>';
    				if ( $instance['showcount'] ) {
    					echo ' ('.$term->count.')';
    				}
    				echo '</li>';
    			}
    			echo '</ul>';
    		}
    		echo $after_widget;
    	}

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic