Gallery with images in multiple

<?php
/**
* Gallery Image
*
* @package BE_Genesis_Child
* @since 1.0.0
* @link https://github.com/billerickson/BE-Genesis-Child
* @author Bill Erickson <[email protected]>
* @copyright Copyright (c) 2011, Bill Erickson
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
*
*/
// Remove Things
add_filter( 'prepend_attachment', '__return_false' );
remove_action( 'genesis_after_post', 'genesis_get_comments_template' );
remove_action( 'genesis_post_title', 'genesis_do_post_title' );
remove_action( 'genesis_before_post_content', 'genesis_post_info' );
/**
* Attachment Content
*
*/
function be_attachment_content() {
global $post;
echo '<p class="attachment-navigation">';
previous_image_link( false, '&laquo; Previous' );
$all = isset( $_GET['dcf_gallery'] ) ? get_permalink( esc_attr( $_GET['dcf_gallery'] ) ) : get_permalink( $post->post_parent );
echo ' | <a href="' . $all . '">All Photos</a> | ';
next_image_link( false, 'Next &raquo;' );
echo '</p>';
$image = wp_get_attachment_image_src( get_the_ID(), 'large' );
echo '<p class="attachment"><img src="' . $image[0] . '" /></p>';
}
add_action( 'genesis_post_content', 'be_attachment_content', 5 );
/**
* Add Gallery Arg to Adjacent Link
*
*/
function be_previous_gallery_link( $output, $id, $size, $permalink, $icon, $text ) {
$id = intval( $id );
$_post = get_post( $id );
if ( empty( $_post ) || ( 'attachment' != $_post->post_type ) || ! $url = wp_get_attachment_url( $_post->ID ) )
return __( 'Missing Attachment' );
if ( $permalink )
$url = get_attachment_link( $_post->ID );
if( isset( $_GET['dcf_gallery'] ) )
$url = add_query_arg( 'dcf_gallery', esc_attr( $_GET['dcf_gallery'] ), $url );
$post_title = esc_attr( $_post->post_title );
if ( $text )
$link_text = $text;
elseif ( $size && 'none' != $size )
$link_text = wp_get_attachment_image( $id, $size, $icon );
else
$link_text = '';
if ( trim( $link_text ) == '' )
$link_text = $_post->post_title;
return '<a href="' . $url . '" title="' . $post_title . '">' . $link_text . '</a>';
}
add_filter( 'wp_get_attachment_link', 'be_previous_gallery_link', 10, 6 );
genesis();
view raw attachment.php hosted with ❤ by GitHub
view raw single-gallery.php hosted with ❤ by GitHub

Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributing developer to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.

Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk