Neverending tag problem
Neverending tag problem
Neverending tag problem
Referenced from https://codex.wordpress.org/Post_Status_Transitions#.7Bstatus.7D_.7Bpost_type.7D_Hook the hook named “{status}_{post_type} Hook”. This hooks is fired, when custom post type “community” is giving the status “publish” = is published. Hook will give post_id and post object as parameters to the callback function. And wp_set_post_terms, requires first parameter as post ID. This should work: add_action(‘publish_community’, ‘community_post_type_tagging’, 10, 2); function community_post_type_tagging($post_id, … Read more
I use this on my instals to get rid of p tags around images: /* * * Remove annoying <p> tags on images, messes with my shizzle * */ function my_filter_ptags_on_images($content) { return preg_replace(‘/<p>(\s*)(<img .* \/>)(\s*)<\/p>/iU’, ‘\2’, $content); } add_filter(‘the_content’, ‘my_filter_ptags_on_images’);
Easy thing, install plugin called tinymce-advanced and in the setting page for the plugin just click check box for Stop removing the p and br tags when saving and show them in HTML editor and save.
Paste this code along side the code given by you I have not tested the code but it should do the trick… where you used this [blog1 items=1 cat=op-ed] replace this with this [blogtag items=1 tag=china] <?php $queried_object = get_queried_object(); $term = $queried_object->name; add_shortcode(“blogtag”, “blog_tag”); function blog_tag($atts, $content) { extract(shortcode_atts(array( “items” => 4, “tag” => … Read more
This will disable the Tags suggesstion: function wpse207107_dequeue_suggest() { global $post_type; if ( is_admin() && $post_type == ‘post’ ) { wp_dequeue_script( ‘suggest’ ); wp_deregister_script( ‘suggest’ ); } } add_action( ‘admin_enqueue_scripts’, ‘wpse207107_dequeue_suggest’, 5 ); However, that might disable some other suggest functionalities if other plugins uses the script. Alternatively, you can entirely remove the Tags metag … Read more
Take a look at the tag parameters of the WP_Query class. You’ll most likely need to create three separate queries. <?php $query = new WP_Query( array( ‘posts_per_page’ => -1, ‘no_found_rows’ => true, ‘tag’ => ‘tag1’ ) ); if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); // the_title(); endwhile; wp_reset_postdata(); endif; ?>
if i have understood your question, you want all tags from a taxonomy not applied to your post? maybe you can use get_terms(‘your_custom_taxonomy’) to get all of your tags, and parse/diff to your current post tags to get all tags not applied to your post https://developer.wordpress.org/reference/functions/get_terms/ or maybe try to use a filter like list_term_exclusions … Read more
You are making typical mistake between conditional tags which tell you which kind of page are you on (search in your case) and functions which tell you data of the current post in the loop. What you want in this case is probably get_post_type() and make your output conditional on result of it.
I did this for my product tags, so you just need to change the reference to product_tag and product to post_tag and post. You are basically making the taxonomy of post_tag hierarchical. You will need to add it to your functions.php: //Make Product Tag Hierarchical function wd_hierarchical_tags_register() { // Maintain the built-in rewrite functionality of … Read more