Get TOP x Tags from selected posts

With an array containing the post IDs its easy $post_ids = array( 167, 774, 787, 358 ); $tag_all = array(); foreach ( $post_ids as $post_id ) { $tags = wp_get_post_tags( $post_id, array() ); foreach ( $tags as $tag ) array_push( $tag_all, $tag->name ); } $result = array_count_values($tag_all); arsort( $result ); $result = array_slice( $result, 0, … Read more

WordPress editor, change code wrap (bbpress?)

put this code in functions.php add_action(‘wp_footer’,’ravs_codeTag_fix’); function ravs_codeTag_fix(){ if ( bbp_use_wp_editor() ) : ?> <script> jQuery(document).ready( function() { /* Use <code> instead of backticks for the Code button in the editor */ if ( typeof( edButtons ) !== ‘undefined’ ) { edButtons[110] = new QTags.TagButton( ‘code’, ‘code’, ‘<code>’, ‘</code>’, ‘c’ ); QTags._buttonsInit(); } }); </script> … Read more

Create three unique tag page templates

If you really want to use a singular tag.php file, you can run a regex on your $_SERVER[‘HTTP_REFERER’] value to determine where you’re coming from and then load a template part depending on the result, just be sure to have a default in there. Sorry, I can’t be more specific on the regex without knowing … Read more

Tag selection while adding new post

Just copy paste the following code in your functions.php file which will add some css code in your WordPress back end which will hide the text box and add button of tags meta box to prevent user adding new tags. add_action(‘admin_head’, ‘custom_css’); function custom_css() { echo ‘<style> #tagsdiv-post_tag .howto, #tagsdiv-post_tag .tagadd, #tagsdiv-post_tag #new-tag-post_tag{ display: none; … Read more

Post order by selected tags

You can count the number of tags when a post is saved and store it as a meta key for the post. Now you can just add a sort by the value of the meta key to the tag page query.

Create another TAG widget for posts

You’ll need to use register_taxonomy with hierarchical set to false: function add_custom_taxonomies() { // Add new “Locations” taxonomy to Posts register_taxonomy(‘keyword’, ‘post’, array ( ‘hierarchical’ = false )); } add_action( ‘init’, ‘add_custom_taxonomies’, 0 ); For more information: – WordPress API – Tutorial @ Smashing magazine

Display posts containing at least 1 from a list of say 10 tags but not containing other tags

Paste this code at the end of your child themes functions.php file. It will exclude all posts with the comma separated list of tag i.d’s from displaying on the home page loop. add_filter(‘request’, ‘filter_tag_loop’); function filter_tag_loop($params) { $params[‘tag__not_in’] = array(49); return $params; } Or you could use WP_Query $query = new WP_Query( array( ‘tag__not_in’ => … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)