Filter pictures in the media library [closed]
Filter pictures in the media library [closed]
Filter pictures in the media library [closed]
It looks like whatever the issue is has something to do with upgrading to 3.8 and Magic Fields V2 being up to date. I changed define(‘WP_CACHE’, true); to false, made sure WordPress was up to date, made sure Magic Fields V2 is up to date, no other plugins were active and there were no other … Read more
Here’s what I did (step 3 should probably solve your problem): 1. Update .htaccess File Add the following to the .htaccess file: RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L] 2. Update WordPress Site URL Navigated to Settings > General and update the WordPress Address (URL) and Site Address (URL) to https. 3. Update … Read more
Welcome to WPSE marctain! Edit There are some critiques on using the guid but no one of the commentators managed to edit this answer to a better one, so I’ll do it. Yes, using guid is a bad idea in the long run, I knew that and I should have pointed that out, I didn’t, … Read more
The filter has 2 parameters, also the function name doesn’t match. So your code should look like this: add_filter(‘wp_get_attachment_url’, ‘clrs_get_attachment_url’, 10, 2); function clrs_get_attachment_url($url, $post_id) { // Do what you want to $url return $url; }
There’s a few plugins to fix this, but basically it your database still references the images to be “oldsite.com/wp-content/uploads/” and you need it to be “newsite.com/wp-content/uploads” So you have to change all old references. You could use SQL: UPDATE wp_options SET option_value = replace(option_value, ‘http://www.oldsite.com’, ‘http://www.newsite.com’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’; UPDATE … Read more
So thanks to @amritanshu and @wycks github’s code, here is the solution for those in need to add a class with the media type to the attachment url before it gets inserted in the editor : if ( ! function_exists( ‘epc_add_class_pdf’ ) ) : function epc_add_class_pdf( $html, $id ) { $attachment = get_post( $id ); … Read more
No, that seems to work right. You could test it by doing <?php echo get_the_post_thumbnail(‘grade-image’); ?> try this. add_image_size( “grade-image”, 320, 300, true ); add_filter( ‘image_size_names_choose’, ‘my_custom_sizes’ ); function my_custom_sizes( $sizes ) { return array_merge( $sizes, array( ‘grade-image’ => __(‘Grade Image’), ) ); }
The better title for this would be: How to use the WordPress media uploader to upload images into settings page. 1- Add the necessary scripts to show the media uploader: add_action(‘admin_footer’, function() { /* if possible try not to queue this all over the admin by adding your settings GET page val into next if( … Read more
(function ($) { “use strict”; $(function () { var button = $(‘.upload-image’); button.click(function (e) { e.preventDefault(); // If the media frame already exists, reopen it. if (file_frame) { file_frame.open(); return; } var btn = $(this), media = wp.media; // Create the media frame. var file_frame = media.frames.file_frame = media({ title: jQuery(this).data(‘uploader_title’), button: { text: jQuery(this).data(‘uploader_button_text’) … Read more