• boblebad

    (@boblebad)


    When searching for this, i found this guide for it, but it doesn’t work however i put the code. Has something been changed so it doesn’t work anymore ?

    https://wordpress.stackexchange.com/questions/341805/wordpress-tag-cloud-add-more-links

    This is the code that is supposed to go into the category-template.php file.

    add_filter( 'wp_tag_cloud', function ( $return, $args ) {
        if ( 'array' != $args['format'] ) {
            $return .= '<a href="<YOUR LINK URL>" class="more"><YOUR LINK CAPTION></a>';
        }
    
        return $return;
    }, 10, 2 );


    But putting it in there, it just breaks the site. The guide says to put it last in the wp_tag_cloud function. That doesn’t work.

    My point is to have a page where i list all the Tags i have, so users that way can choose which posts they want to have listed. Therefor i need a link at the bottom of my Tag Cloud that users can click to go to that page.

    Any help very much appreciated, thank you ??

    All the best
    Carsten

Viewing 16 replies (of 16 total)
  • Moderator bcworkz

    (@bcworkz)

    Assuming they have a filter or action hook we can use, then generally yes. However, success might depend on order of execution. For example, you can affect the main query through the “pre_get_posts” action, but if you were to add your callback from a template file it would have no effect because the query had already run.

    There are a few hooks where adding from a theme’s functions.php is too late, but adding works fine from a plugin which is loaded much earlier.

Viewing 16 replies (of 16 total)
  • The topic ‘Adding “See all” link to Tag Cloud’ is closed to new replies.