Count images in post then add class if just one

Using @pascalvgemert’s suggestion as a starting point, I’m using the following script: jQuery(document).ready(function() { var imgCount = jQuery(“.single-post #content-left p a”).children(“img”).length; if (imgCount == 1) { jQuery(“img”).addClass(“lone-image”); } }); Works like a charm.

Bulk delete media by year

We tried with couple of plugins , but there isn’t any with option to bulk delete images by month or year. If you have access to wp-cli you can try to delete attachments by year and month with: wp post delete $(wp post list –post_type=”attachment” -—year=2016 -—monthnum=12 –format=ids) or just by year with: wp post … Read more

Open attachments in new tab/window

Presuming you don’t have a blank install have you tried disabling all your active plugins to see if it might be a conflict? If you can set the links to open in a new window when no plugins are active then activate one plugin at a time to figure out the culprit. Also check if … Read more

Custom Fields, Media uploader, Attachments

There are a few different ways to get your values. One way is in the loop and another way is outside the loop. Here is a short code snippet that can be used to get them outside the loop ( untested ) <?php global $wp_query; $postid = $wp_query->post->ID; echo get_post_meta($postid, ‘customField’, true); ?> You will … Read more

Attachment page custom title?

I believe that attachment.php is the template for attachment pages. So you can edit existing one or create new if you have none. You can also create different templates for different mime types: http://codex.wordpress.org/Template_Hierarchy Edit: Sorry, in a case you want to change HTML page title, you may want to use is_attachment() in header.php of … Read more

techhipbettruvabetnorabahisbahis forumutaraftarium24edueduedusedusedueduseduedueduedus