Tag Info

New answers tagged

1

For non-hierarchical terms (such as tags), you can pass either the term name or id. If you pass the id there is only one caveat: You must pass it as an integer, and it must be in an array. This is necessary because any non-array value passed will be converted to a string, which will be interpreted as a term name. $tag = '5'; // Wrong. This will add the tag ...


0

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.


1

Your code has a couple of flaws which I'm not going to go into detail now. Here is a short list pre_get_posts is an action On any type of archive page you need to make sure you only target the main query and the front end when using pre_get_posts Your syntax is very hard to debug and not supported by most code editors. Although if (): else : endif; is ...


0

I had this problem when running multi-site and the user was only an admin of the site. I as super-admin could put whatever html attributes I wanted. I am sure the long term solution is not to raise their privileges, but it could be a place to start trouble shooting. @jochem, I have gone down the route of making the tinymce changes, but that does not seem ...


1

The code below assumes that only one tag ( 'private' ) has a text associated with it: function add_tag_text_to_title( $title, $id = null ) { if ( has_tag( 'private' ) ) { return $title . ' - Awesome'; } else { return $title; } } add_filter( 'the_title', 'add_tag_text_to_title', 10, 2 ); If you have more than one tag with text ...


0

I really do think that my-sticky is not actually your term's name, but actually the slug. Usually, multiple words in the term name is separated by spaces, and the first letters are capitilized. Slugs are all small letters with multiple words separated by hyphens. So I would change name to slug in get_term_by(). Just one note, with multiple taxonomies and ...


1

I think you should check for some other platform. WordPress is made to be live all the time : ) But if you are really keen in doing it in WordPress I can suggest a hard way of doing it. You can use the JSON-REST-API for WordPress and jQuery Mobile to build a mobile app that will run on any browser (not only mobile browser). Thank with cache manifest and ...


0

You need to use 'tag__not_in' and you need the ID of the Tag. Have a look into https://codex.wordpress.org/Function_Reference/get_term_by to retrieve the term object, where the ID is contained.


1

Use tag__not_in parameter. You have to use tag ID for this parameter $args = array( 'category_name' => $cat_name, 'tag' => $tag_name, 'post__not_in' => $sticky, 'tag__not_in' => array($tag_id_1, $tag_id_2) ); $my_query = new WP_Query( $args );


0

use this at functions.php /* Tagcloud, change the font size */ function custom_tag_cloud_widget($args) { $args['largest'] = 13; //largest tag $args['smallest'] = 13; //smallest tag $args['unit'] = 'px'; //tag font unit return $args; } add_filter( 'widget_tag_cloud_args', 'custom_tag_cloud_widget' );


0

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');


0

WordPress search only handles posts, it doesn't handle taxonomies and their terms ( tags, categories etc ) If you want more advanced search you'll have to use a 3rd party solution


0

Try going to your permalinks page within the admin to flush the rewrite rules. Just be navigating to that page will flush the rules, but you could click save even if you made no changes.



Top 50 recent answers are included