Catégories

Identification

Inscription | Coordonnées perdu?

Publicité

Redcarpet

Voici un petit tutorial anglophone pour les utilisateurs du theme payant RedCarpet depuis deluxethemes.com , ce tutorial permet de mettre les miniatures en dessous de la galerie photo au lieu de la placer au dessu.

Uploader votre image représentative de l'article, largeur 640px / hauteur 240px.

By default RedCarpet shows the miniature images above the gallery, if you desire to have the miniature image under the gallery you only need to switch some source code.. [DEMO]

it's realy simple follow these 3 steps:

 

1. Identify yourself in your admin panel, go to Appearance/Editor and select the main.php file. (Another way is to download trough your ftp software the main.php file located at ./wp-content/themes/redcarpet/functions/)

 

2. Then you have to find the functions that talks about the gallery. The functions you have to find are gallery_from_attachements() and gallery_from_images(). They looks like this:

/********************************************************************

create gallery from [gallery] code or post attachments

********************************************************************/

function gallery_from_attachments() {



	global $post, $deluxe;

	$img_uploads = get_children( array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'DESC', 'orderby' => 'menu_order ID', 'numberposts' => -1) );



	if ($img_uploads == true) {



	print '<h2>'.__('Viewing photos','deluxe').'</h2>';

	print '<p><strong>'.__('(<a href="#comments">read users comments</a> or <a href="#respond">add a reply</a>)','deluxe').'</strong></p>';

	print '<ul id="photos" class="photos">';

	

	$key = 0;

	foreach($img_uploads as $id => $attachment) {

	$img = wp_get_attachment_image_src($id, 'full');

	$key++;

	print '<li><a href="#" rel="'.$key.'" class="'; if ($key == 1) print 'selected'; print'"><img src="'.get_bloginfo('template_directory').'/thumbs/timthumb.php?src='.urlencode($img[0]).'&amp;w=85&amp;h=75&amp;zc=1&amp;a=t&amp;q=100" alt="" title="" /></a></li>';

	}

	

	print '<div class="clear"></div></ul><div class="clear"></div>';

	print '<div class="pos-div">';



	$key = 0;

	foreach($img_uploads as $id => $attachment) {

	$img = wp_get_attachment_image_src($id, 'full');

	$key++;

	print '<div id="'.$key.'" class="tabcontent">

	<a href="'.$img[0].'" class="group" rel="group1" title=""><img src="'.get_bloginfo('template_directory').'/thumbs/timthumb.php?src='.urlencode($img[0]).'&amp;w=300&amp;h=300&amp;zc=1&amp;a=t&amp;q=100" alt="" title="" /></a>';

	print '<a href="javascript:photos.cycleit(\'prev\')" class="prev1">'.__('&laquo; Previous Photo','deluxe').'</a>

	<a href="javascript:photos.cycleit(\'next\')" class="next1">'.__('Next Photo &raquo;','deluxe').'</a>

	<p class="para">'.sprintf(__('You are viewing image number <b>%1$s</b> of total <b>%2$s</b> images.','deluxe'), $key, count($img_uploads)).'</p>';

	print '</div>';

	}



	print '</div>';

	

	print '<script type="text/javascript">

	var photos=new ddtabcontent("photos")

	photos.setpersist(false)

	photos.setselectedClassTarget("link")

	photos.init()

	</script>';

	?>

	<div class="sharingb" style="margin: 0 0 0 0;padding: 0 0 0 0;"><div class="sharing"><span class="post-to"><?php _e('Post To','deluxe'); ?>:</span><?php social_bookmarks(); ?><?php if(function_exists('wp_email')) { email_link(); } ?><div class="clear"></div></div><div class="clear"></div></div>

	<?php

	

	}



}



/********************************************************************

create gallery from post images

********************************************************************/

function gallery_from_images() {



	global $post, $deluxe;

	preg_match_all('/\< *[img][^\>]*src *= *[\"\']{0,1}([^\"\'\ >]*)/',get_the_content(),$matches);



	if (count($matches[1]) > 0) {



	print '<h2>'.__('Viewing photos','deluxe').'</h2>';

	print '<p><strong>'.__('(<a href="#comments">read users comments</a> or <a href="#respond">add a reply</a>)','deluxe').'</strong></p>';

	print '<ul id="photos" class="photos">';

	

	foreach($matches[1] as $key => $img_src) {

	$key2 = $key + 1;

	print '<li><a href="#" rel="'.$key2.'" class="'; if ($key2 == 1) print 'selected'; print'"><img src="'.get_bloginfo('template_directory').'/thumbs/timthumb.php?src='.urlencode($img_src).'&amp;w=85&amp;h=75&amp;zc=1&amp;a=t&amp;q=100" alt="" title="" /></a></li>';

	}

	

	print '<div class="clear"></div></ul><div class="clear"></div>';

	print '<div class="pos-div">';

	

	foreach($matches[1] as $key => $img_src) {

	$key2 = $key + 1;

	print '<div id="'.$key2.'" class="tabcontent">

	<a href="'.$img_src.'" class="group" rel="group1" title=""><img src="'.get_bloginfo('template_directory').'/thumbs/timthumb.php?src='.urlencode($img_src).'&amp;w=300&amp;h=300&amp;zc=1&amp;a=t&amp;q=100" alt="" title="" /></a>';

	print '<a href="javascript:photos.cycleit(\'prev\')" class="prev1">'.__('&laquo; Previous Photo','deluxe').'</a>

	<a href="javascript:photos.cycleit(\'next\')" class="next1">'.__('Next Photo &raquo;','deluxe').'</a>

	<p class="para">'.sprintf(__('You are viewing image number <b>%1$s</b> of total <b>%2$s</b> images.','deluxe'), $key2, count($matches[1])).'</p>';

	print '</div>';

	}



	print '</div>';



	print '<script type="text/javascript">

	var photos=new ddtabcontent("photos")

	photos.setpersist(false)

	photos.setselectedClassTarget("link")

	photos.init()

	</script>';

	?>

	<div class="sharingb" style="margin: 0 0 0 0;padding: 0 0 0 0;"><div class="sharing"><span class="post-to"><?php _e('Post To','deluxe'); ?>:</span><?php social_bookmarks(); ?><?php if(function_exists('wp_email')) { email_link(); } ?><div class="clear"></div></div><div class="clear"></div></div>

	<?php

	

	}



}

It looks pretty long but don't worry, we don't need to change everything..we will just switch 2 things. We want the miniature under the gallery so go to next step.

 

3. In the section above just find :

	print '<ul id="photos" class="photos">';

	

	$key = 0;

	foreach($img_uploads as $id => $attachment) {

	$img = wp_get_attachment_image_src($id, 'full');

	$key++;

	print '<li><a href="#" rel="'.$key.'" class="'; if ($key == 1) print 'selected'; print'"><img src="'.get_bloginfo('template_directory').'/thumbs/timthumb.php?src='.urlencode($img[0]).'&amp;w=85&amp;h=75&amp;zc=1&amp;a=t&amp;q=100" alt="" title="" /></a></li>';

	}

	

	print '<div class="clear"></div></ul><div class="clear"></div>';

	print '<div class="pos-div">';



	$key = 0;

	foreach($img_uploads as $id => $attachment) {

	$img = wp_get_attachment_image_src($id, 'full');

	$key++;

	print '<div id="'.$key.'" class="tabcontent">

	<a href="'.$img[0].'" class="group" rel="group1" title=""><img src="'.get_bloginfo('template_directory').'/thumbs/timthumb.php?src='.urlencode($img[0]).'&amp;w=300&amp;h=300&amp;zc=1&amp;a=t&amp;q=100" alt="" title="" /></a>';

	print '<a href="javascript:photos.cycleit(\'prev\')" class="prev1">'.__('&laquo; Previous Photo','deluxe').'</a>

	<a href="javascript:photos.cycleit(\'next\')" class="next1">'.__('Next Photo &raquo;','deluxe').'</a>

	<p class="para">'.sprintf(__('You are viewing image number <b>%1$s</b> of total <b>%2$s</b> images.','deluxe'), $key, count($img_uploads)).'</p>';

	print '</div>';

	}



	print '</div>';

and replace it by thise one :

// Galerie
	print '<div class="pos-div">';
	$key = 0;
	foreach($img_uploads as $id => $attachment) {
	$img = wp_get_attachment_image_src($id, 'full');
	$key++;
	print '<div id="'.$key.'" class="tabcontent">
	<a href="'.$img[0].'" class="group" rel="group1" title=""><img src="'.get_bloginfo('template_directory').'/thumbs/timthumb.php?src='.urlencode($img[0]).'&amp;w=300&amp;h=300&amp;zc=1&amp;a=t&amp;q=100" alt="" title="" /></a>';
	print '<a href="javascript:photos.cycleit(\'prev\')" class="prev1">'.__('&laquo; Previous Photo','deluxe').'</a>
	<a href="javascript:photos.cycleit(\'next\')" class="next1">'.__('Next Photo &raquo;','deluxe').'</a>
	<p class="para">'.sprintf(__('You are viewing image number <b>%1$s</b> of total <b>%2$s</b> images.','deluxe'), $key, count($img_uploads)).'</p>';
	print '</div>';

	}
	print '</div>';



 // Miniatures
	print '<ul id="photos" class="photos">';
	$key = 0;
  foreach($img_uploads as $id => $attachment) {
  	$img = wp_get_attachment_image_src($id, 'full');
  	$key++;
  	print '<li><a href="#" rel="'.$key.'" class="'; if ($key == 1) print 'selected'; print'"><img src="'.get_bloginfo('template_directory').'/thumbs/timthumb.php?src='.urlencode($img[0]).'&amp;w=85&amp;h=75&amp;zc=1&amp;a=t&amp;q=100" alt="" title="" /></a></li>';
  }
	print '<div class="clear"></div></ul><div class="clear"></div>';

You also have to find :

print '<ul id="photos" class="photos">';

	

	foreach($matches[1] as $key => $img_src) {

	$key2 = $key + 1;

	print '<li><a href="#" rel="'.$key2.'" class="'; if ($key2 == 1) print 'selected'; print'"><img src="'.get_bloginfo('template_directory').'/thumbs/timthumb.php?src='.urlencode($img_src).'&amp;w=85&amp;h=75&amp;zc=1&amp;a=t&amp;q=100" alt="" title="" /></a></li>';

	}

	

	print '<div class="clear"></div></ul><div class="clear"></div>';

	print '<div class="pos-div">';

	

	foreach($matches[1] as $key => $img_src) {

	$key2 = $key + 1;

	print '<div id="'.$key2.'" class="tabcontent">

	<a href="'.$img_src.'" class="group" rel="group1" title=""><img src="'.get_bloginfo('template_directory').'/thumbs/timthumb.php?src='.urlencode($img_src).'&amp;w=300&amp;h=300&amp;zc=1&amp;a=t&amp;q=100" alt="" title="" /></a>';

	print '<a href="javascript:photos.cycleit(\'prev\')" class="prev1">'.__('&laquo; Previous Photo','deluxe').'</a>

	<a href="javascript:photos.cycleit(\'next\')" class="next1">'.__('Next Photo &raquo;','deluxe').'</a>

	<p class="para">'.sprintf(__('You are viewing image number <b>%1$s</b> of total <b>%2$s</b> images.','deluxe'), $key2, count($matches[1])).'</p>';

	print '</div>';

	}



	print '</div>';

and replace it by:

// Galerie
	print '<div class="pos-div">';
	foreach($matches[1] as $key => $img_src) {
	$key2 = $key + 1;
	print '<div id="'.$key2.'" class="tabcontent">
	<a href="'.$img_src.'" class="group" rel="group1" title=""><img src="'.get_bloginfo('template_directory').'/thumbs/timthumb.php?src='.urlencode($img_src).'&amp;w=300&amp;h=300&amp;zc=1&amp;a=t&amp;q=100" alt="" title="" /></a>';
	print '<a href="javascript:photos.cycleit(\'prev\')" class="prev1">'.__('&laquo; Previous Photo','deluxe').'</a>
	<a href="javascript:photos.cycleit(\'next\')" class="next1">'.__('Next Photo &raquo;','deluxe').'</a>
	<p class="para">'.sprintf(__('You are viewing image number <b>%1$s</b> of total <b>%2$s</b> images.','deluxe'), $key2, count($matches[1])).'</p>';
	print '</div>';
	}
	print '</div>';
	
	
	
	// Miniature
	print '<ul id="photos" class="photos">';
	foreach($matches[1] as $key => $img_src) {
	$key2 = $key + 1;
	print '<li><a href="#" rel="'.$key2.'" class="'; if ($key2 == 1) print 'selected'; print'"><img src="'.get_bloginfo('template_directory').'/thumbs/timthumb.php?src='.urlencode($img_src).'&amp;w=85&amp;h=75&amp;zc=1&amp;a=t&amp;q=100" alt="" title="" /></a></li>';
	}
	print '<div class="clear"></div></ul><div class="clear"></div>';

 

Finaly save your file and you will notice that the miniatures are under the gallery.. don't forget to visit avenue2star for his contribuation!

Commentaires

Actuellement il n'y à aucun commentaire pour cette article, soyez le premier à en écrire un!

Laisser un commentaire

Pour écrire un commentaire vous devez vous identifier ou vous inscrire sur le site!

Devlopped by Ghyselinck Sebastiaan © ghijselinck.com