Custom Taxonomy-specific JavaScript

For a function that enqueues scripts, the action hook you use should actually be “wp_enqueue_scripts” for the front of the site, and “admin_enqueue_scripts” for the admin side of things. This is the proper time to enqueue scripts. While you can technically do it anytime before wp_head, this is the best place because it’s pretty much … Read more

How to change “Draft” string for status of custom post type to “Unavailable”?

I was investigating the issue for this question, and one option is using the plugin Edit Flow. It can be configured to display custom post_status in specific CPT’s, but further tests are necessary to see if it applies to this case. Other option is using toscho’s Retranslate plugin, where you can define the string to … Read more

How to get current_cat in navbar, in single post

I found the answer here. Add to functions.php the following function and hook: function sgr_show_current_cat_on_single($output) { global $post; if( is_single() ) { $categories = wp_get_post_categories($post->ID); foreach( $categories as $catid ) { $cat = get_category($catid); // Find cat-item-ID in the string if(preg_match(‘#cat-item-‘ . $cat->cat_ID . ‘#’, $output)) { $output = str_replace(‘cat-item-‘.$cat->cat_ID, ‘cat-item-‘.$cat->cat_ID . ‘ current-cat’, $output); … Read more

Creating “static” taxonomies to choose from, inside custom post type?

Make it show_ui => false Then to show it on the post edit screen add the box manually add_action(‘add_meta_boxes’, ‘meta_boxes_function’); function meta_boxes_function() { add_meta_box(‘categoriesdiv’, ‘categories’, ‘post_categories_meta_box’, ‘blurb’, ‘side’, null, array(‘taxonomy’ => ‘categories’)); } use this code for every static term if(!term_exists(‘term1’, ‘categories’)) wp_insert_term(‘term1’, ‘categories’);

How Is Network Activate Different From Activate (by Implementation)?

Network activation will activate a plugin for every site in a network whereas regular activation will only activate a plugin for the site you’re currently on. As far as implementation goes, there is one other important difference: If your plugin is built to do something when it’s activated (via register_activation_hook()), this will fire automatically when … Read more

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