Tag Info

Hot answers tagged

5

The documentation for register_post_type mentions a taxonomies parameter, giving it a value of array( 'category' ) will do what you want. There is also the register_taxonomy_for_object_type function


1

After 'public' => true, you add 'taxonomies' => array('category','post_tag'), this one create category and tag for your custom post type if you want just category the delete ,'post_tag'.


1

I added the function register_taxonomy_for_object_type( $taxonomy, $object_type ) in functions.php. First: I need to choose which kind of taxonomy I want, in this case, "category". Second: I choose the object type, in this case, "cupom" that is my Custom Post Type. add_action('init','add_categories_to_cupom'); function add_categories_to_cupom(){ ...


1

There is a plugin for that: WP No Category Base. This plugin will remove that part of the URL. https://wordpress.org/plugins/wp-no-category-base/


1

If you have a lot of categories it will be a pain to search everytime every category and check against the field value. I wrote something and I would love to know if it's correct or not 1st I wrote a function that get the option name from the value since wordpress core provide only a function that get the option value from name function ...


1

I am not sure what exactly you want. But I assume you want the desktop view in your mobile browser instead of responsive layout. You can use viewport to achieve this. Please check this tutorial: http://webdesign.tutsplus.com/articles/quick-tip-dont-forget-the-viewport-meta-tag--webdesign-5972


1

Most likely the problem comes from: $terms = get_the_terms( $post->ID, $args['taxonomy'] ); i.e. you have to make sure it's not false or WP_Error object. You should also check the output of: var_dump( $args ); Try for example: if( ! is_array( $terms ) ) return $output; or if( ! $terms || is_wp_error( $terms ) ) return $output; ...


1

I haven't run this code so there may be a syntax error, but the gist is to return userfeed-taxonomy with the terms specified that have featured category OR cities-taxonomy with the terms specified and featured category OR anything else that's not those taxonomies. It's kind of clunky, maybe there is a better way: $query->set( 'tax_query', array( ...



Only top voted, non community-wiki answers of a minimum length are eligible