Limit Tag Links in Post Content

function link_words( $text ) { $replace=””; $tags = get_the_tags(); $count=0; if ( $tags ) { foreach ( $tags as $tag ) { $count++; echo $sep . ‘<a href=”‘.get_tag_link($tag->term_id).'”>’.$tag->name.'</a>’; $sep = ‘, ‘; if( $count > 2 ) break; } } } add_filter( ‘the_content’, ‘link_words’, 10, 1 ); Check this.

Add Custom Taxonomy into Script

I think you should use json_encode in the page that you would like to run. Here is some ideas how you to solves. add_action(‘admin_init’, ‘my_taxonomy_list’); function my_taxonomy_list() { if (specific_page) { //check not to run in other pages $taxonomies = get_taxonomies(); foreach ( $taxonomies as $taxonomy ) { $tax_list[] = $taxonomy->slug; } ?> <script> var … Read more

How to create archive pages for metadata query generated posts (so without taxonomy)?

A fairly simple way to do this is to create a new page with the slug likedby, then add some rewrite rules to handle the extra parameters. First, the query var that holds the requested username: function wpd_likedby_query_var( $query_vars ) { $query_vars[] = ‘likeduser’; return $query_vars; } add_filter( ‘query_vars’, ‘wpd_likedby_query_var’ ); Then a couple of … Read more

Show custom taxonomy in theme

If you want to list out the custom taxonomy you have to use get_terms function For your requirement instead of creating new taxonomy you can modify the default category it self function custom_change_cat_object() { global $wp_taxonomies; $labels = &$wp_taxonomies[‘category’]->labels; $labels->name=”Author”; $labels->singular_name=”Author”; $labels->add_new = ‘Add Author’; $labels->add_new_item = ‘Add Author’; $labels->edit_item = ‘Edit Author’; $labels->new_item = … Read more