Add anchor tag on previous_image_link / next_image_link

i’m usig the code for create a link (next and prev) $attachments = array_values( get_children( array( ‘post_parent’ => $post->post_parent, ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => ‘ASC’, ‘orderby’ => ‘menu_order ID’ ) ) ); foreach ( $attachments as $k => $attachment ) : if ( $attachment->ID == $post->ID ) break; endforeach; … Read more

Setting name of attachment URL

You can hook onto add_attachment and force the slug to work off the filename like so: Update: To uppercase the slug, you’ll need to add a temporary filter onto wp_unique_post_slug. You can’t simply use strtoupper( $slug ) as WordPress sanitises (lowercases) it within the update function. /** * Force attachment slug to ignore title from … Read more

Assign one featured image to multiple posts?

I’d suggest you check the $featuredimg URL. If there is already an attachment with this URL just get the ID and call update_post_meta( $pid, ‘_thumbnail_id’, $thumb_id ); There’s a useful function to get the ID for an existing URL: Philip Newcomer function pn_get_attachment_id_from_url( $attachment_url=”” ) { global $wpdb; $attachment_id = false; // If there is … Read more

How do I embed youtube video via url in frontend posting

WordPress supports quite a few embeds including YouTube since WordPress 2.9. To render anywhere, just pass your content through the_content filter and it should automatically convert the urls. $oembedContent = apply_filters( ‘the_content’, $basicContent ); If the defaults don’t meet your needs you can add an oEmbed-Enabled site using wp_oembed_add_provider( $format, $provider, $regex ) or add … Read more

Custom styling Insert Media window

You shouldn’t change core files this is bad practice and your changes will be overridden every time you update WordPress to the latest version. You can rather use the admin head hook (http://codex.wordpress.org/Plugin_API/Action_Reference/admin_head) in your themes functions file and override the styles. So it would look something like this… // Hook into the admin head … Read more