Audio and video shortcodes not working properly

Okay, there are two things going on. First, since you are running WordPress 3.6, you don’t need to run any other media player plugins. Deactivate Widgetkit and use the following shortcode to add your audio player: The reason you aren’t seeing the play button on your players is that your web server is not serving … Read more

Add select field to media uploader that adds a class to the image

To apply the class you need a custom function to do something with the value of your setting. To make sure the selected stays selected use the WP selected() function $form_fields[‘image-type’][‘html’] = “<select name=”attachments[{$post->ID}][profile_image_select]”>”; $form_fields[‘image-type’][‘html’] .= ‘<option ‘.selected(get_post_meta($post->ID, “_profile_image_select”, true), ‘default’,false).’ value=”‘ . $normal_image . ‘”>Normal Image</option>’; $form_fields[‘image-type’][‘html’] .= ‘<option ‘.selected(get_post_meta($post->ID, “_profile_image_select”, true), ‘default’,false).’ value=”‘ … Read more

How to side load an image from a service

Short answer, you don’t. Functions like sideload are for importing images into WordPress itself and using all the normal media library stuff. For images on an external service, use normal img tags. If you want to copy an image from a URL, you sideload it. Not otherwise.

add_image_size landscape or portrait

What you’re asking for is functionally equivalent to scaling images to fit within a bounding square of each size, so could be achieved with this: add_image_size(‘big_xxl’, 4500, 4500); add_image_size(‘big_xl’, 3300, 3300); add_image_size(‘big’, 2100, 2100); add_image_size(‘medium’, 1250, 1250); Consider a landscape image that is 5000×500. These rules will generate images scaled to 4500, 3300, 2100 and … Read more

Add a header before fields added with the attachment_fields_to_edit() filter

I’ve found out that you can use the tr attribute for creating entire rows: function my_attachment_fields_to_edit( $form_fields, $post ) { $form_fields[‘attachment-header’][‘tr’] = ‘ <tr> <td colspan=”2″> <h2>My title</h2> </td> </tr>’; $form_fields[‘attachment-url’] = array( ‘label’ => __( ‘URL’, ‘plugin’ ), ‘input’ => ‘text’, ‘value’ => get_post_meta( $post->ID, ‘_attachment_url’, true ) ); $form_fields[‘attachment-width’] = array( ‘label’ => … Read more

Can’t edit media details in new role

As mentioned in my comment(s), below the code as it imho should be.(tested and working) /** * Add new role: Writer * This role allows to: Add/Edit/Delete Posts and Uploads * * Read more: {@link https://codex.wordpress.org/Roles_and_Capabilities} * * Works with @version WP4.8.1 and below */ add_role( ‘writer’, ‘Writer’, array( ‘delete_posts’ => true, ‘delete_published_posts’ => true, … Read more

Can’t access ‘Store uploads in this folder’

This is a very good question. The answer to the referenced post requires a change to the WP options. They are stored in the database in the wp_options table (assuming wp_ is your prefix). There are a few ways to change these in this case: Direct DB access: if you’re comfortable modifying the WP DB … Read more

How to make programmatic image upload generate thumbnail and sizes?

In order for wp_generate_attachment_metadata() to work properly in that it creates a thumbnail and other intermediate/image sizes like medium and large, the image attachment/post data must have the proper MIME type (post_mime_type), and despite you did set it in your $attachment array (the post data), there’s a problem with this part in your code: $wp_filetype … Read more

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