Skip to content

Instantly share code, notes, and snippets.

@subharanjanm
Created December 6, 2017 03:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save subharanjanm/aa06ccd4f9bad1cf34f437f84eeebdb1 to your computer and use it in GitHub Desktop.
Save subharanjanm/aa06ccd4f9bad1cf34f437f84eeebdb1 to your computer and use it in GitHub Desktop.
Testimonials Widget Tag Cloud Link Customization
<?php
global $tw_template_args;
if ( ! function_exists( 'axl_modify_tag_cloud_link' ) ) {
function axl_modify_tag_cloud_link( $tags_data ) {
foreach ( $tags_data as $key => $tag ) {
if ( ( ! empty( $tag['url'] ) ) && $tag['url'] != '#' ) {
$tag['url'] = $tag['url'] . '?post_type=testimonials-widget';
}
}
return $tags_data;
}
}
$atts = $tw_template_args['atts'];
?>
<div class="tagcloud">
<?php
$args = array(
'taxonomy' => $atts['taxonomy'],
);
add_filter( 'wp_generate_tag_cloud_data', 'axl_modify_tag_cloud_link' );
wp_tag_cloud( apply_filters( 'tw_tag_cloud_args', $args ) );
remove_filter( 'wp_generate_tag_cloud_data', 'axl_modify_tag_cloud_link', 10 );
?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment