How to customise the output of the WP image gallery shortcode from a plugin?

There’s two ways you can go about this, but both involve creating a function that does pretty much the same as the existing gallery shortcode function… You can either.. Hook onto post_gallery and manipulate the incoming data(you can use the gallery shortcode function as a base for the filter if necessary) Unregister the gallery shortcode … Read more

Split Content and Gallery

Open to anybody who can simplify this but here’s what I came up with that worked for me. First thing’s first – get the gallery, using get_post_gallery(), as soon as the loop starts: <?php if( have_posts() ) : ?> <?php while( have_posts() ) : the_post(); $gallery = get_post_gallery(); $content = strip_shortcode_gallery( get_the_content() ); ?> <div … Read more

Turn a URL into an Attachment / Post ID

Massively improved function developed for plugin heavy on images: if ( ! function_exists( ‘get_attachment_id’ ) ) { /** * Get the Attachment ID for a given image URL. * * @link http://wordpress.stackexchange.com/a/7094 * * @param string $url * * @return boolean|integer */ function get_attachment_id( $url ) { $dir = wp_upload_dir(); // baseurl never has a … Read more

Horizontal ListView in Android?

As per Android Documentation RecyclerView is the new way to organize the items in listview and to be displayed horizontally Advantages: Since by using Recyclerview Adapter, ViewHolder pattern is automatically implemented Animation is easy to perform Many more features More Information about RecyclerView: grokkingandroid.com antonioleiva.com Sample: survivingwithandroid.com Just add the below block to make the … Read more