Buyrun eklentinin linki: http://wordpress.org/plugins/tp-gallery-slider/
Eklenti resmi:
Arkadaşlar Slider kodlarının tamamını paylaşıyorum.
/*
Plugin Name: T&P Gallery Slider
Version: 1.2
Description: Display and change post gallery images by mouse onclick/hover the post thumbnails.
Author: Peyman Shadpour & Tzachi Raz
Author URI:http://www.bytech.co.il/
Plugin URI: http://wordpress.org/extend/plugins/tp-gallery-slider/
Requires at least: 3.0
Tested up to: 3.5.1
Stable tag: 1.2
*/
/*------------------------------------------------------------- Settings Page -------------------------------------------------------------*/
if( !function_exists('tp_gallery_settings') )
{
function tp_gallery_settings()
{
//add_menu_page(page_title, menu_title, capability, handle, [function], [icon_url]);
add_menu_page("T&P Gallery Slider Setting", "T&P Setting", 8, basename(__FILE__), "tp_gallery_opt");
}
}
if ( !function_exists('tp_gallery_opt') )
{
function tp_gallery_opt()
{
?>
T&P Gallery Slider Settings
if(isset($_POST['tp_gallery_form_submit']))
{
echo 'T&P Gallery Slider Settings was saved successfully!';
}
?>
$tp_select_change = get_option("tp_select_change");
if($tp_select_change == 'click'){
$flag = 'click';
}else{
$flag = 'hover';
}
?>
T&P Gallery Slider Preview
if($tp_display_alt == 'yes'){
echo '1st image description';
}
?>
<script>
jQuery('#tp_thumbs').delegate('img','', function(){
jQuery('#largeImage').attr('src',jQuery(this).attr('src').replace('thumb','large'));
jQuery('#description').html(jQuery(this).attr('alt'));
});
</script>
}
}
if( !function_exists('tp_gallery_update') )
{
function tp_gallery_update()
{
if(isset($_POST['tp_gallery_form_submit']))
{
update_option("tp_width", $_POST['tp_width']);
update_option("tp_height", $_POST['tp_height']);
update_option("tp_select_change", $_POST['tp_select_change']);
update_option("tp_display_alt", $_POST['tp_display_alt']);
update_option("tp_description_position", $_POST['tp_description_position']);
}
}
}
add_action('admin_menu', 'tp_gallery_settings');
add_action('init', 'tp_gallery_update');
/*--------------------------------------------------------- End Settings Page -------------------------------------------------------------*/
if (!is_admin()) {
load_plugin_textdomain('tp_gallery_slider', NULL, dirname(plugin_basename(__FILE__)));
add_shortcode('tp_gallery', 'tp_gallery_slider');
//add_action('wp_head', 'tp_enqueue_scripts');
add_action('wp_footer', 'tp_gallery_slider_footer');
add_action('init', 'tp_enqueue_scripts');
}
/**
* Register with hook 'wp_enqueue_scripts', which can be used for front end CSS and JavaScript
*/
add_action( 'wp_head', 'tp_stylesheet' );
/**
* Enqueue plugin style-file
*/
function tp_stylesheet() {
$tp_width = get_option("tp_width");
$tp_height = get_option("tp_height");
$tp_description_position = get_option("tp_description_position");
if(!$tp_description_position){
$tp_description_position = "bottom";
}
?>
}//tp_stylesheet()
function tp_enqueue_scripts() {
wp_enqueue_script("jquery");
}
function tp_gallery_slider_footer() {
if ( function_exists('plugin_url') )
$plugin_url = plugin_url();
else
$plugin_url = get_option('siteurl') . '/wp-content/plugins/' . plugin_basename(dirname(__FILE__));
/**
* Initialize
*/
$tp_select_change = get_option("tp_select_change");
if($tp_select_change == 'click'){
$flag = 'click';
}else{
$flag = 'hover';
}
echo '<script>
jQuery("#tp_thumbs").delegate("img","'.$flag.'", function(){
jQuery("#largeImage").attr("src",jQuery(this).attr("src").replace("thumb","large"));
jQuery("#description").html(jQuery(this).attr("alt"));
});
</script>';
}
function tp_gallery_slider($atts) {
/**
* Grab attachments
*/
global $post;
extract(shortcode_atts(array(
'post_id' => 1,
), $atts));
if(!$atts){
$post_id = $post->ID;
}
$attachments = get_children( array('post_parent' => $post_id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') );
$first_value = reset($attachments);
$big_image_src = wp_get_attachment_image_src(key($attachments),"full");
$tp_display_alt = get_option("tp_display_alt");
if ( empty($attachments) )
return '';
$output = ' ';//tp_gallery_slider
return $output;
}
?>