Show media url immediately after upload in media uploader

Here’s a heinous hack that replaces the title of uploaded images with the url (constructed by chopping the “-150×150” affix from the pinkynail): function wpse156087_admin_footer_media_new_php() { ?> <script type=”text/javascript”> jQuery(document).ready(function() { (function ($) { uploader.bind(‘UploadComplete’, function() { setTimeout(function() { $(‘#media-items .media-item’).each(function () { var img_src = $(‘img’, this).prop(‘src’); if (img_src.indexOf(‘/wp-content/uploads/’) > 0) { $(‘.filename.new .title’, … Read more

Override img class in gallery

You should add !important to your styles in order to override it. Better way to do this is to copy the .img-responsive styles from the Bootstrap CSS file and apply these styles to your desired HTML element instead of adding a class using PHP. img.attachment-large { display: block; max-width: 100%; height: auto; } Or target … Read more

Image thumbnails not available post migration, but still accessible via direct URL – DB issue

Domain change This kind of error may be caused by wrong host name in image urls that are stored in the database. It is necessary to replace strings holding your old domain with new one: http://olddomain.com –> http://newdomain.com In every migtration process I use the following recommended tool: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ Upload it to your WP root … Read more

WooCommerce-like featured gallery

I found a solution to this. I am using the plugin (No UI) Metabox that has this feature by default. This is the code i used to achieve my desired result: add_filter( ‘rwmb_meta_boxes’, ‘prefix_register_meta_boxes’ ); function prefix_register_meta_boxes( $meta_boxes ) { $prefix = ‘rw_’; $meta_boxes[] = array( ‘title’ => ‘Media’, ‘pages’ => array( ‘bestilling’), ‘fields’ => … Read more

How to display / include a specific jpg on a page

To load images from the location you currently have them stored use get_site_url() to generate a path: $a = date(‘md’).”.jpg”; $a = get_site_url(null,’images/’.$a); // var_dump($a); Then use that information to create an img tag. I would recommend loading the images from a theme folder, if this is part of a particular theme. If that is … Read more

Output random (custom) image size

I don’t think there exists such function in the WordPress core. Example #1 But you can try something like this: /** * Random image size * @return String Image size */ function wpse_random_image_size() { $sizes = (array) get_intermediate_image_sizes(); return $sizes[array_rand( $sizes )]; } to display a random image size. Usage: if ( function_exists( ‘wpse_random_image_size’ ) … Read more

All Images on wordpress site broken

It’s due to AAM (Advanced Access Manager) plugin. You have different options to fix the issue. 1) Disable AAM Media Manager plugin 2) You can changes AAM Media Manager plugin version 3) If you do not want AAM to handle your website images, Go to the following file /advanced-access-manager/extension/AAM_Media_Manager/extension.php and find private $_skip = false; … Read more

Print specific image size in galley loop

You can define your own post thumbnail sizes add_theme_support( ‘post-thumbnails’ ); set_post_thumbnail_size( 150, 150 ); This means that you change the thumbnail size overall. Or you can define custom image sizes add_action( ‘after_setup_theme’, ‘wpdocs_theme_setup’ ); function wpdocs_theme_setup() { add_image_size( ‘category-thumb’, 300 ); // 300 pixels wide (and unlimited height) add_image_size( ‘homepage-thumb’, 220, 180, true ); … Read more

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