WordPress.org

Ready to get started?Download WordPress

Forums

GPP Slideshow
How to Move Thumbnails Below and Keep Open (4 posts)

  1. RandomWP
    Member
    Posted 2 years ago #

    Great plugin! Thanks for your piece of (code) art.
    I have two small things that I've been rattling my brain trying to solve looking through the plugin's code, alas I have been unable to resolve them.

    First one was how to move the thumbnails (and if possible menu too) below the main displayed image? :/ I thought of going into gpp_functions.php where all the echo statements are but apparently rearranging them didn't work. If you could give me any pointers into which file determines the placement of each div I could try to nut it out again! Or if you're happy to help me in any greater detail that would be awesome.

    Second one I though would be fairly simple (involving turning a false value to true) but couldn't find how to keep the thumbnail tray open as default instead of the default being with the thumbnail tray closed.

    Help would be much appreciated, and again thanks for a visually appealing plugin.

    http://wordpress.org/extend/plugins/gpp-slideshow/

  2. RandomWP
    Member
    Posted 2 years ago #

    I know it's only been 10 minutes since I posted (lol), but I just left out that its' kind of urgent as I have to get it done by end of this coming week :O

  3. donnamaxine
    Member
    Posted 1 year ago #

    Anyone figured out how to move the thumbnails and navigation to below the slides?

  4. b.decker
    Member
    Posted 1 year ago #

    Hello guys, i did it but only moved navigation. You have to change all gpp_functions.php with this code:

    <?php
    
    /*-----------------------------------------------------------------------------------*/
    /* Outputs all the images attached to a post */
    /*-----------------------------------------------------------------------------------*/
    
    function gpp_gallery_images($size='large') {
    
    	$gpp = get_option('gpp_gallery');	
    
    	if ( $images = get_children(array(
    		'post_parent' => get_the_ID(),
    		'post_type' => 'attachment',
    		'order' => 'ASC',
    		'orderby' => 'menu_order ID',
    		'post_mime_type' => 'image',)))
    	{
    
    		echo "\n\n",'<!-- #slideshow -->',"\n",
    					'<div class="gpp_slideshow_wrapper" class="clearfix">',"\n",
    					'<div class="flexslider">',"\n", 
    
    				'<div class="clear"></div>',"\n";
    
    		echo '<ul class="gpp_slideshow_thumbnails" style="display:none">',"\n";
    
    		foreach( $images as $image ) {
    			$attachmentimage = wp_get_attachment_image( $image->ID, 'thumbnail' );
    			echo "\t",'<li><a href="#">',"\n";
    			echo "\t\t",$attachmentimage.apply_filters('the_title', isset($parent->post_title)),"\n";
    			echo "\t",'</a></li>',"\n";
    		}
    
    		echo	'</ul>',"\n",
    					'<div class="clear"></div>',"\n",
    					'<div id="slideshowloader"></div>',"\n";
    
    		echo "\n",'<ul class="slides">',"\n"; 
    
    		foreach( $images as $image ) {
    			$attachmentimage = wp_get_attachment_image( $image->ID, 'large');
    			$description = $image->post_content;
    			echo "\t",'<li>',"\n";
    			echo "\t\t",$attachmentimage.apply_filters('the_title', isset($parent->post_title)),"\n";
    			if (isset($description))
    				echo "\t\t",'<div class="flex-caption" style="display:none">'.$description.'</div>',"\n";
    			echo "\t",'</li>',"\n";
    		}
    		echo '</ul><!-- .slides -->',"\n";
    
    		echo '<br/><div class="gpp_slideshow_menu" class="clearfix">',"\n",
    					"\t",'<div class="slideshow_options">',"\n",
    						"\t\t",'<a class="show_thumbnails" href="#" title="Show thumbnails">Show thumbnails</a>',"\n",
    						"\t\t",'<a class="show_captions" href="#" title="Caption">Caption</a>',"\n",
    					"\t",'</div>',"\n",
    
                            "\t",'<div class="slideshow_nav">',"\n",
                            "\t",'<ul class="flex-direction-nav">',"\n",
                            "\t",'<li>',"\n",
        						"\t\t",'<a href="#" class="prev" title="Previous">Previous</a>',"\n",
        						"\t",'</li>',"\n",
        						"\t",'<li>',"\n",
        						"\t\t",'<a href="#" class="next" title="Next">Next</a>',"\n",
        						"\t",'</li>',"\n",
        					"\t",'</ul>',"\n",
        					"\t",'</div>',"\n",
    
    				'</div>',"\n";
    
    		echo '</div><!-- .flexslider -->',"\n";
    		echo '</div><!-- .gpp_slideshow_wrapper -->',"\n\n";
    	}
    }
    
    /*-----------------------------------------------------------------------------------*/
    /* Prints the plugin credits */
    /*-----------------------------------------------------------------------------------*/
    
    function gpp_gallery_credits() {
    	echo '<div id="credits"><p>Plugin by <a href="http://graphpaperpress.com" target="_blank"> Graph Paper Press</a></p></div>';
    }
    
    /*-----------------------------------------------------------------------------------*/
    /* Print the name of the user-defined slug */
    /*-----------------------------------------------------------------------------------*/
    
    function gpp_gallery_slug() {
    
    	$gallery = get_option('gpp_gallery');
    
    	if ( empty ( $gallery['galleries'] ) )
    		$slug = "Galleries"; // if plural name is empty
    	else
    		$slug = $gallery['galleries']; // plural name
    
    	echo $slug;
    
    }
    
    /*-----------------------------------------------------------------------------------*/
    /* Change icons in admin for custom post type */
    /*-----------------------------------------------------------------------------------*/
    
    add_action('admin_head', 'gpp_gallery_admin_head');
    
    /**
    * Change the icon on every page where post type is workshop
    * Also save template paths to vars
    */
    function gpp_gallery_admin_head() {
    	global $post_type;
    
    	$post_type = isset($post_type) ? $post_type : '';
    	$_GET['post_type'] = isset($_GET['post_type']) ? $_GET['post_type'] : '';
    	$_GET['post'] = isset($_GET['post']) ? $_GET['post'] : '';
    	?>
    	<style>
    	<?php if (($_GET['post_type'] == 'gallery') || ($post_type == 'gallery') || (get_post_type($_GET['post']) == 'gallery')) : ?>
    	#icon-edit, #icon-post {
    		background:transparent url('<?php echo GPP_GALLERY_PLUGIN_URL . '/img/icon.png'; ?>') no-repeat;
    		background-position: -4px -7px;
    		height: 45px;
    		width: 45px;
    	}
    	#credits {
    		background:transparent url('<?php echo GPP_GALLERY_PLUGIN_URL . '/img/gpp.png'; ?>') no-repeat;
    		padding-left: 70px;
    		min-height: 50px;
    		margin: 50px 0 0;
    	}
    	#credits p {
    		padding-top: 25px;
    	}
    	<?php endif; ?>
    	</style>
    
    	<?php
    }
    
    /***********  replace default gallery shortcode with gpp-slideshow-gallery *************/
    add_action('wp_head','add_gpp_gallery');
    function add_gpp_gallery() {
      $gpp = get_option('gpp_gallery');
    
    	if ( isset($gpp['pages'] ) && $gpp['pages'] == '1' && !is_page_template('page-blog.php') ) {
    
        remove_shortcode('gallery', 'gallery_shortcode');
        add_shortcode('gallery', 'gpp_gallery_shortcode');
    
    	} else {
    
        if( !is_page_template('page-blog.php') ){
            remove_shortcode('gallery', 'gallery_shortcode');
            add_shortcode('gallery', 'gpp_gallery_shortcode');
        }
    	}
    }
    
    //replace default gallery shortcode by image slider if not blog category
    function gpp_gallery_shortcode($attr) {
       global $post;
    	$gpp = get_option('gpp_gallery');
    	// We're trusting author input, so let's at least make sure it looks like a valid orderby statement
    	if ( isset( $attr['orderby'] ) ) {
    		$attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );
    		if ( !$attr['orderby'] )
    			unset( $attr['orderby'] );
    	}
    
    	extract(shortcode_atts(array(
    		'order'      => 'ASC',
    		'orderby'    => 'menu_order ID',
    		'id'         => $post->ID,
    		'columns'    => 3,
    		'size'       => 'thumbnail-50',
    		'include'    => '',
    		'exclude'    => ''
    	), $attr));
    
    	$id = intval($id);
    	if ( 'RAND' == $order )
    		$orderby = 'none';
    
    	if ( !empty($include) ) {
    		$include = preg_replace( '/[^0-9,]+/', '', $include );
    		$_attachments = get_posts( array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
    
    		$attachments = array();
    		foreach ( $_attachments as $key => $val ) {
    			$attachments[$val->ID] = $_attachments[$key];
    		}
    	} elseif ( !empty($exclude) ) {
    		$exclude = preg_replace( '/[^0-9,]+/', '', $exclude );
    		$attachments = get_children( array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
    	} else {
    		$attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
    	}
    
    	if ( empty($attachments) )
    		return '';
    	ob_start();
    	echo '<div class="flexslider">',"\n",
    	        '<div class="gpp_slideshow_menu" class="clearfix">',
    					"\t",'<div class="slideshow_options">',
    						"\t\t",'<a class="show_thumbnails" href="#" title="Show thumbnails">Show thumbnails</a>',
    						"\t\t",'<a class="show_captions" href="#" title="Caption">Caption</a>',
    					"\t",'</div>',
    
                             "\t",'<div class="slideshow_nav">',"\n",
                                "\t",'<ul class="flex-direction-nav">',"\n",
                                "\t",'<li>',"\n",
            						"\t\t",'<a href="#" class="prev" title="Previous">Previous</a>',"\n",
            						"\t",'</li>',"\n",
            						"\t",'<li>',"\n",
            						"\t\t",'<a href="#" class="next" title="Next">Next</a>',"\n",
            						"\t",'</li>',"\n",
            					"\t",'</ul>',"\n",
            					"\t",'</div>',"\n",
    
    				'</div>',
    				'<div class="clear"></div>';
    
    		echo '<ul class="gpp_slideshow_thumbnails" style="display:none">';
    
    		foreach ( $attachments as $id => $attachment ) {
    			$attachmentimage = wp_get_attachment_image( $id, 'thumbnail' );
    			echo "\t",'<li><a href="#">';
    			echo "\t\t",$attachmentimage.apply_filters('the_title', isset($parent->post_title));
    			echo "\t",'</a></li>';
    		}
    
    		echo	'</ul>',
    					'<div class="clear"></div>',
    					'<div id="slideshowloader"></div>';	
    
    		 echo "\n",'<ul class="slides">',"\n";
    
    		foreach ( $attachments as $id => $attachment ) {
    			$attachmentimage = wp_get_attachment_image( $id, 'large');
    			$description = $attachment->post_title;
    			echo "\t",'<li>',"\n";
    			echo "\t\t",$attachmentimage.apply_filters('the_title', isset($parent->post_title));
    			if (isset($description))
    				echo "\t\t",'<div class="flex-caption" style="display:none">'.$description.'</div>';
    			echo "\t",'</li>',"\n";
    		}
    		echo '</ul><!-- .slides -->',"\n";
    		echo '</div><!-- .flexslider -->',"\n";
    		$gallery = ob_get_clean();
    		return $gallery;
    		ob_end_clean();
     }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.