Only current gallery images with get_attached_media

Found an answer using Shortcode which helped: How to get Page/Post Gallery attachment images in order they are set in backend using WP_Query()? My working code now looks like this: // Extract the shortcode arguments from the $page or $post $shortcode_args = shortcode_parse_atts(get_match(‘/\[gallery\s(.*)\]/isU’, $post->post_content)); // get the ids specified in the shortcode call $ids = … Read more

Customizing individual images on posts

The best answer I had was to add a &nbsp in the function callback html at the end of the section tag. This forced the curser out of section wrapper in the WYSIWIG of WordPress. It’s not the perfect fix but it worked. function html5_insert_image($html, $id, $caption, $title, $alt, $align, $url) { $url = wp_get_attachment_url($id); … 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

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