• Hi Thiago,
    thanks for this nice plugin.
    For a client’s website, where administrators are accostumed to use nggallery in order to manage lists of images, I added some functionalities to wp-skitter-slideshow so that they can select a gallery to be shown as slideshow.

    For those who may be interested here’s how I made it, please note that this is a hard-code edit and it will be lost in next update (though its quite simple to restore).

    All modifications are made on plugins/wp-skitter-slideshow/wp-skitter-slideshow.php

    First I added a setting in function getSkitterSettings() (line 103):

    function getSkitterSettings()
    {
    	$wp_skitter_settings = array(
    		'wp_skitter_gallery', // Added this
    		'wp_skitter_category',
    		'wp_skitter_slides',
    ...

    Then I added an option in the activate function wp_skitter_activate() (line 156)

    function wp_skitter_activate()
    {
    	add_option('wp_skitter_category','1');
    	add_option('wp_skitter_gallery','1'); // Added this
    	add_option('wp_skitter_animation','random');
    ...

    Then three edits on the big function show_skitter() (line 305)

    function show_skitter()
    {
    	$width_skitter = get_option('wp_skitter_width');
    	$height_skitter = get_option('wp_skitter_height');
    
    	$category = get_option('wp_skitter_category');
    	$wp_skitter_slides = get_option('wp_skitter_slides');
    
    	$gallery = get_option('wp_skitter_gallery'); // Added this to retrieve current selected gallery
    ?>
    ...
    ...
    case 'xml' :
    			$skitter_xml = true;
    
    			break;
    
    		case 'gallery' : // Added this case
    
    			if(class_exists(nggdb)) { // Check if nggallery plugin is installed
    			$wp_skitter_animation = get_option('wp_skitter_animation'); // Use default selected animation
    
    				global $nggdb;
    				$imagegallery = new nggdb();
    				$images = $imagegallery->get_gallery($gallery); // Retrieve a list of all active images in the selected gallery
    
    					if($images) { // Build the $skitter_images[] array
    						foreach($images as $oneimageingal) {
    							$skitter_images[] = array(
    							'image' => $oneimageingal->imageURL,
    							'link' => '',
    							'label' => $oneimageingal->description,
    							'animation' => $wp_skitter_animation,
    						);
    						}
    					}
    			}
    			break;
    
    		case 'posts' : default :
    ...
    ...
    $block = array('wp_skitter_category', 'wp_skitter_slides', 'wp_skitter_width', 'wp_skitter_height', 'wp_skitter_type', 'wp_skitter_attachments');
    		$block[] = 'wp_skitter_gallery'; // Added this
    
    		foreach ($settings as $option) {
    ...

    And finally the big edits for showing the settings tab in Admin – wp_skitter_menu_function()
    (line 659)

    $selected_xml = ($wp_skitter_type == 'xml') ? 'class="tab_selected_sk"' : '';
    		$selected_gallery = ($wp_skitter_type == 'gallery') ? 'class="tab_selected_sk"' : ''; // Added this

    (line 663)

    $tab_selected_xml = ($wp_skitter_type == 'xml') ? ' tab_item_selected_sk' : '';
    		$tab_selected_gallery = ($wp_skitter_type == 'gallery') ? ' tab_item_selected_sk' : ''; // Added this

    (line 669)

    <?php
    ...
    			/* Added this
    			// If nggallery is installed add the option to choose a gallery
    			*/
    			if(class_exists(nggdb)) {  ?>
    				<a href="#gallery" rel="tab_gallery_sk" <?=$selected_gallery;?>><?php _e('Gallery'); ?></a>
    			<?php } ?>
    		</div>
    
    		<?php
    			/* Added this by Webartisanit
    			// If nggallery is installed adds a settings panel specifical
    			*/
    			if(class_exists(nggdb)) {  ?>
    		<div id="tab_gallery_sk" class="tab_item_sk<?=$tab_selected_gallery;?>">
    			<table class="form-table">
    				<tr valign="top">
    					<th scope="row"><?php _e('Gallery'); ?></th>
    					<td>
    						<?php
    						global $nggdb;
    						$gallery = get_option('wp_skitter_gallery'); // Current (or default) gallery
            		$galleries = $nggdb->find_all_galleries('gid', 'DESC'); // List of all available galleries
    
          			// Build the dropdown menu with the galleries to choose from
    						?>
    						<select name="wp_skitter_gallery" id="wp_skitter_gallery">
    							<?php
    								if($galleries) {
    								foreach($galleries AS $onegallery) {
    									$selectedgal = ($gallery==$onegallery->gid) ? ' selected="selected" ' : '';
    										echo '<option ' . $selectedgal . ' value="' . $onegallery->gid . '">' . $onegallery->title . '</option>';
    									}
    								}
    							?>
    						</select>
    					</td>
    				</tr>
    			</table>
    		</div>
    		<?php } ?>
    		...

    http://wordpress.org/extend/plugins/wp-skitter-slideshow/

  • The topic ‘Skitter and NextGEN Gallery integration’ is closed to new replies.