Remove tabs from media uploader for a CPT

You can use the media_upload_tabs filter check for your post type and unset any tab you don’t want ex: function remove_media_library_tab($tabs) { if (isset($_REQUEST[‘post_id’])) { $post_type = get_post_type($_REQUEST[‘post_id’]); if (‘premium’ == $post_type) unset($tabs[‘library’]); unset($tabs[‘type_url’]); } return $tabs; } add_filter(‘media_upload_tabs’, ‘remove_media_library_tab’);

Block metabox – No expanding, no moving around

Deregistering the postbox script seemed a little bit drastic and as mentioned the “Edit” button for the permalink slug does not work as expected anymore. I actually came up another method which uses filters from WordPress and the functionality of the jQuery UI sortable plugin allowing to cancel the sort when it is issued from … Read more

Creating a Custom Post Types dropdown in a Meta Box

Of course it is possible. Below is code that will display registered post types: function my_meta_box_add() { add_meta_box( ‘my-meta-box-id’, ‘MY meta’, ‘my_meta_box’, ‘page’, ‘normal’, ‘high’ ); } add_action( ‘add_meta_boxes’, ‘my_meta_box_add’ ); function my_meta_box( $post ) { ?> <p> <label for=”my_meta_box_post_type”>Post type: </label> <select name=”my_meta_box_post_type” id=’my_meta_box_post_type’> <?php $post_types=get_post_types(”, ‘objects’); foreach ($post_types as $post_type): ?> <option value=”<?php … Read more

custom fields for attachments?

Here is a tutorial that shows how to add custom fields to the attachments/media gallery/thickbox/iframe/whatever-you-call it overlay. I’ve successfully used it, but have not yet taken it much further by adding radio buttons/checkboxes/etc or messed with limiting the changes to particular post types, but that all looks completely doable too. Here is the code from … Read more

Undefined function error when creating Custom Meta Box

Try this add_action( ‘add_meta_boxes’, ‘cd_meta_box_add’ ); function cd_meta_box_add() { add_meta_box( ‘my-meta-box-id’, ‘My First Meta Box’, ‘cd_meta_box_cb’, ‘post’, ‘normal’, ‘high’ ); } function cd_meta_box_cb() { echo ‘What you put here, show\’s up in the meta box’; } ps: you have some extra problematic lines, at the top of your code, that I removed, namely: add_meta_box( ‘my-meta-box-id’, … Read more

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