Allow author to upload image via Media button without plugin

in the basic configuration the user role contributor and subscriber do not have the capability upload_files. The user role author has this capability. The capability upload_files gives the user the panels “Media” and “Media > Add New”. If you want another role to grant this capability, you can use the function add_cap(). Since such changes … Read more

Don’t show avatars in media library

Like most page loads in WordPress, WP_Query is intimately involved meaning pre_get_posts is your friend. Proof of concept: function step_2($qry) { $qry->set(‘post__not_in’,array(468,303)); } function step_1() { add_action(‘pre_get_posts’,’step_2′); } add_action(‘load-upload.php’,’step_1′); I’m using the load-upload.php hook to isolate the filter to the “Library” page. If you’ve changed the uploads folder for your avatars you’ve already got some … Read more

Uploaded image doesn’t show up in media library

The missing element that makes a file appear in the media library is the attachment post. Attachment posts hold the file metadata, and are what get associated to posts via the post_parent when a file is “attached”. Instead of wp_handle_upload, you can use the function media_handle_upload, which will handle the file upload as well as … Read more

Password protected uploaded PDF page

Try using the Advanced Custom Fields plugin: http://www.advancedcustomfields.com/ You can add a file(s) upload field to your “designs” post type, and hide the regular content editor. Then you can create a custom template for that post type that displays the files attached to the post.

Add a image uploader in the posts page backend

For custom fields in the backend (like an extra image or extra text) in a post backend we are using Advanced custom fields. This is for us the most easy way to add extra variables to the backend. They also have a function especially for images or a gallery. In your theme you can use … Read more

Limit attachment caption characters

do you have a custom meta field associated with the image? if so place this in your functions.php: <?php $trim_length = 21; //desired length of text to display $custom_field = ‘your custom field key here’; $value = get_post_meta($post->ID, $custom_field, true); if ($value) { echo ‘<p>I want to use: ‘ . rtrim(substr($value,0,$trim_length)) . ‘…</p>’; } ?> … Read more

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