Help changing a tag cloud in wordpress

Discussion in 'HTML & Website Design' started by TheNoose, Dec 27, 2008.

  1. #1
    Hello,

    If anyone is familiar with tag clouds in wordpress, do you know how I would change it to a simple alphabetical ordered list with no font size variation.

    Right now it just lists then alphabetically, in varying font sizes and also in set width rows.

    So instead of

    Tags
    ___ ___ _____
    _____ __ ___
    ______ ___ __

    I'd like:

    Tags
    ___
    ___
    ___
    ___
    ___

    Here's the current code:

    function wp_tag_cloud( $args = '' ) {
    $defaults = array(
    'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45,
    'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC',
    'exclude' => '', 'include' => '', 'link' => 'view'
    );
    $args = wp_parse_args( $args, $defaults );

    $tags = get_tags( array_merge( $args, array( 'orderby' => 'count', 'order' => 'DESC' ) ) ); // Always query top tags

    if ( empty( $tags ) )
    return;

    foreach ( $tags as $key => $tag ) {
    if ( 'edit' == $args['link'] )
    $link = get_edit_tag_link( $tag->term_id );
    else
    $link = get_tag_link( $tag->term_id );
    if ( is_wp_error( $link ) )
    return false;

    $tags[ $key ]->link = $link;
    $tags[ $key ]->id = $tag->term_id;
    }

    $return = wp_generate_tag_cloud( $tags, $args ); // Here's where those top tags get sorted according to $args

    $return = apply_filters( 'wp_tag_cloud', $return, $args );

    if ( 'array' == $args['format'] )
    return $return;

    echo $return;
    }


    Thanks.
     
    TheNoose, Dec 27, 2008 IP
  2. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #2
    I'm not familiar with that part of the turdpress codebase, but if I was to guess I would assume changing 'largest' and 'smallest' to the same value would do the trick in that initial array.

    EXCELLENT example though of how wordpress loves to hardcode into the functionality part of the code **** that should be controlled in the skin or CSS.
     
    deathshadow, Dec 27, 2008 IP
  3. TheNoose

    TheNoose Peon

    Messages:
    1,005
    Likes Received:
    22
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes, that changed it to the same size.

    To change it to list format... you change the format value to 'list'... imagine that.
     
    TheNoose, Dec 27, 2008 IP