Created
December 6, 2017 03:33
-
-
Save subharanjanm/aa06ccd4f9bad1cf34f437f84eeebdb1 to your computer and use it in GitHub Desktop.
Testimonials Widget Tag Cloud Link Customization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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