Changer ordres des portfolios :)

  • WordPress :4.7
  • Statut : non résolu
5 sujets de 1 à 5 (sur un total de 5)
  • Auteur
    Messages
  • #1884938

    guiflow
    Participant
    Initié WordPress
    6 contributions

    Bonjour,

    Ma configuration WP actuelle

    Problème(s) rencontré(s) :

    Bonjour à tous, alors j’ai juste un petit soucis sur le site que je monte pour mon collectif de DJ, j’utilise un thème que j’ai depuis longtmeps mais je n’avais jamais utilisé, et l’aide en ligne du thème est ‘périmée’ donc on me demande environ 30$ pour répondre à ma question… donc bon…

    Ma question, sur la page des portfolios ici : http://p171.phpnet.org/tutupanpan/focus l’ordre est du plus ancien vers le pus récent, et je veux juste changer ça par le plus récent vers le plus ancien…

    Je suis allé dans le PHP concerné par cette page qui s’appelle ‘Modèle de page Portfolio 3 Columns + Right Sidebars’ maiq je ne trouve comment modifier l’ordre…

    Quelqu’un aurait une idée ? Car en PHP c’est pas mon fort, j’avoue 😉

    Merci du retour !

    • Ce sujet a été modifié le il y a 1 semaine et 2 jours par  guiflow.
    #1884945

    Flobogo
    Modérateur
    Maître WordPress
    13132 contributions

    Bonjour,

    Mettez-nous le code du fichier concerné, on essaiera de rajouter la condition pour trier en ordre inverse.

    Par contre, vous êtes sûr que les 30 $ c’est juste pour vous répondre, il n’y a pas de mise à jour à faire sur ce thème ? Si il y a longtemps que vous l’avez, il n’est peut-être plus très « frais » 😀

    Des thèmes « portfolio », il en sort régulièrement, et même parmi les gratuits, il y en a de très bien faits 😎

    #1884950

    guiflow
    Participant
    Initié WordPress
    6 contributions

    Merci Flobogo pour la réponse !

    Alors, j’ai la dernière version du thème justement, récupérée sur Themeforest hier ! Et oui les 30$ c’est pour ça, car j’ai posé la question du dev et la réponse était, paye et on te répondra, en gros…

    Sinon, ci-dessous le code php de la page en question !

    C’est top si tu peux trouver la solution 🙂 et si tu veux écouter du bon son, ben c’est ici : http://p171.phpnet.org/tutupanpan/ !

    <?php
    /**
     * Template Name: Portfolio 3 Columns + Right Sidebars
     * The main template file for display portfolio page.
     *
     * @package WordPress
    */
    
    if(!isset($hide_header) OR !$hide_header)
    {
    	get_header(); 
    }
    
    /**
    *	Get Current page object
    **/
    $page = get_page($post->ID);
    
    /**
    *	Get current page id
    **/
    
    if(!isset($current_page_id) && isset($page->ID))
    {
        $current_page_id = $page->ID;
    }
    
    //Get page description
    $page_desc = get_post_meta($current_page_id, 'page_desc', true);
    
    //Get page Sidebar
    $page_sidebar = get_post_meta($current_page_id, 'page_sidebar', true);
    if(empty($page_sidebar))
    {
    	$page_sidebar = 'Portfolio Sidebar';
    }
    
    //If display on homepage then disable header
    if(!isset($hide_header) OR !$hide_header)
    {
    ?>				
    		
    </div>
    
    <!-- Begin content -->
    <div id="content_wrapper">
    
        <div class="page_caption">
        	<div class="caption_inner">
        		<div class="caption_header">
        			<h1 class="cufon"><span><?php the_title(); ?></span></h1>
        			<div class="caption_asc">
        				<?php echo stripcslashes($page_desc); ?>
        			</div>
        		</div>
        		<?php
    				//Include social icons
    				include (TEMPLATEPATH . "/templates/socials-icons.php");
    			?>
        	</div>
        	<br class="clear"/>
        </div>
        <br class="clear"/>
        
        <div class="inner">
        
        	<!-- Begin main content -->
        	<div class="inner_wrapper">
        	
        	<div class="standard_wrapper">
        	
        	<!-- Begin portfolio content -->
    		<?php
    		    $menu_sets_query = '';
    		    $portfolio_items = -1;
    		    $cur_post = 0;
    		    
    		    //Get all portfolio items for paging
    		    $args = array(
    		    	'numberposts' => $portfolio_items,
    		    	'order' => 'ASC',
    		    	'orderby' => 'menu_order',
    		    	'post_type' => array('portfolios'),
    		    );
    		    if(!empty($term))
    		    {
    		    	$args['portfoliosets'].= $term;
    		    }
    		    
    		    $all_photo_arr = get_posts($args);
    		    $total = count($all_photo_arr);
    		?>
    		
    		<?php
    			//Get AJAX portfolio items
    			$ajax_portfolios_arr = array();
    			
    			foreach($all_photo_arr as $key => $portfolio_item)
    		    {
    		    	$portfolio_type = get_post_meta($portfolio_item->ID, 'portfolio_type', true);
    		    
    		    	if($portfolio_type == 'AJAX Portfolio Content')
    		    	{
    		    		$ajax_portfolios_arr[] = $portfolio_item;
    		    	}
    		    }
    		    
    		    $count_ajax_items = count($ajax_portfolios_arr);
    		    
    		    foreach($ajax_portfolios_arr as $key => $portfolio_item)
    		    {
    		    	//Get portfolio gallery ID
    		    	$portfolio_gallery_id = get_post_meta($portfolio_item->ID, 'portfolio_gallery_id', true);
    		    	
    		    	//Get next and prev ajax item
    		    	if(isset($ajax_portfolios_arr[$key+1]))
    		    	{
    			    	$portfolio_next_id = $ajax_portfolios_arr[$key+1]->ID;
    		    	}
    		    	else
    		    	{
    			    	$portfolio_next_id = $ajax_portfolios_arr[0]->ID;
    		    	}
    		    	
    		    	if(isset($ajax_portfolios_arr[$key-1]))
    		    	{
    			    	$portfolio_prev_id = $ajax_portfolios_arr[$key-1]->ID;
    		    	}
    		    	else
    		    	{
    			    	$portfolio_prev_id = $ajax_portfolios_arr[$count_ajax_items-1]->ID;
    		    	}
    		?>
    		    
    		    	<div id="ajax_<?php echo $portfolio_item->ID; ?>" class="ajax_portfolio_wrapper">
    		    		<a class="ajax_close" data-rel="<?php echo $portfolio_item->ID; ?>">x</a>
    		    		<a class="ajax_next ajax_portfolio_direction" data-rel="<?php echo $portfolio_next_id; ?>">→</a>
    		    		<a class="ajax_prev ajax_portfolio_direction" data-rel="<?php echo $portfolio_prev_id; ?>">←</a>
    					<?php
    		    			//If display featured image
    		    			if(empty($portfolio_gallery_id))
    		    			{
    		    		    	$image_thumb = '';
    		    		    								
    		    		    	if(has_post_thumbnail($portfolio_item->ID, 'slide'))
    		    		    	{
    		    		    	    $image_id = get_post_thumbnail_id($portfolio_item->ID);
    		    		    	    $image_thumb = wp_get_attachment_image_src($image_id, 'slide', true);
    		    		    	}
    		    		?>
    		    				<img src="<?php echo $image_thumb[0]; ?>" alt="" class="portfolio_single_img img_shadow"/>
    		    		<?php
    		    			}
    		    			//If display image gallery
    		    			else
    		    			{
    		    		?>
    		    		<br class="clear"/>
    		    		<div id="portfolio_slider_<?php echo $portfolio_item->ID; ?>" class="flexslider portfolio">
    		    			<ul class="slides">
    						<?php
    			    				$portfolio_slider_arr = get_post_meta($portfolio_gallery_id, 'wpsimplegallery_gallery', true);
    			    	    		
    			    	    		foreach($portfolio_slider_arr as $key => $photo_id)
    			    	    		{
    			    	    			if(!empty($photo_id))
    									{
    									    $image_slide = wp_get_attachment_image_src($photo_id, 'slide', true);
    									}
    			    		?>
    			    			
    			    					<li>
    			    						<img src="<?php echo $image_slide[0]; ?>" alt=""/>
    			    					</li>
    			    			
    			    		<?php	
    			    				}
    			    		?>
    		    			</ul>
    		    		</div>
    		    			
    		    		<?php
    		    			//Get portfolio slider settings
    		    			$pp_portfolio_slider_timer = get_option('pp_portfolio_slider_timer');
    		    			if(empty($pp_portfolio_slider_timer))
    		    			{
    		    				$pp_portfolio_slider_timer = 5;
    		    			}
    		    			
    		    			$pp_portfolio_slider_autoplay = get_option('pp_portfolio_slider_autoplay');
    		    		?>
    		    		<script type="text/javascript"> 
    		    		$j(window).load(function() {
    		    		    $j('#portfolio_slider_<?php echo $portfolio_item->ID; ?>').flexslider({
    		    		    	animation: "fade",
    		    		    	<?php
    		    				if(empty($pp_portfolio_slider_autoplay))
    		    				{
    		    				?>
    		    				slideshow: false,
    		    				<?php
    		    				}
    		    				?>
    		    				controlNav: true,
    		    				slideshowSpeed: <?php echo $pp_portfolio_slider_timer*1000; ?>
    		    		    });
    		    		});
    		    		</script>
    		    		
    		    		<?php
    		    			}
    		    		?>	
    		    			<div class="ajax_content">
    		    				<h4 class="center"><?php echo $portfolio_item->post_title; ?></h4><br/><hr/><br/>
    		    				<?php echo pp_apply_content($portfolio_item->post_content); ?>
    		    			</div>
    				</div>
    		    
    		<?php
    		    }
    		?>
    <?php
    }
    ?>				
    		<div class="sidebar_content portfolio_r">
    		
    		<?php
    		    if(!empty($page->post_content) && !is_home())
    		    {
    		    	echo pp_apply_content($page->post_content).'<br class="clear"/><br/>';
    		    }
    		?>
    		
    		<?php
    		    if(isset($all_photo_arr) && !empty($all_photo_arr))
    		    {
    		    	
    		?>
    		<div class="portfolio-content section content clearfix">
    		 	<?php
    		 	
    		 	    foreach($all_photo_arr as $key => $portfolio_item)
    		 	    {
    		 	    	$cur_post++;
    		 	    	$image_url = '';
    		 	
    		 	    	if(has_post_thumbnail($portfolio_item->ID, 'portfolio3l'))
    		 	    	{
    		 	    		$image_id = get_post_thumbnail_id($portfolio_item->ID);
    		 	    		$image_url = wp_get_attachment_image_src($image_id, 'portfolio3l', true);
    		 	    		$full_image_url = wp_get_attachment_image_src($image_id, 'full', true);
    		 	    	}
    		 	    	
    		 	    	$portfolio_link_url = get_post_meta($portfolio_item->ID, 'portfolio_link_url', true);
    		 	    	
    		 	    	if(empty($portfolio_link_url))
    		 	    	{
    		 	    		$permalink_url = get_permalink($portfolio_item->ID);
    		 	    	}
    		 	    	else
    		 	    	{
    		 	    		$permalink_url = $portfolio_link_url;
    		 	    	}
    		 	    	
    		 	    	$portfolio_item_class = 'one_third portfolio';
    		 	    	
    		 	    	$pp_portfolio_image_height = 130;
    		 	?>
    		 	    	<div class="<?php echo $portfolio_item_class; ?>">
    		 	    	
    		 	    	<?php
    		 	    		$portfolio_type = get_post_meta($portfolio_item->ID, 'portfolio_type', true);
    		 	    		$portfolio_video_id = get_post_meta($portfolio_item->ID, 'portfolio_video_id', true);
    		 	    		switch($portfolio_type)
    		 	    		{
    		 	    		case 'External Link':
    		 	    		default:
    		 	    	?>
    		 	    	<div class="portfolio195_shadow">
    		 	    		<a href="<?php echo $permalink_url; ?>">
    		 	    			<img src="<?php echo $image_url[0]?>" alt="" class="portfolio_img"/>
    		 	    			<div class="portfolio195_overlay">
    			 	    			<div class="portfolio195_overlay_inner">
    				    	        	<h5><?php echo $portfolio_item->post_title; ?></h5>
    				    	        	<hr/>
    				    	        	<?php echo pp_substr($portfolio_item->post_excerpt, 80); ?>
    				    	        	<div class="portfolio_type_wrapper">
    				    	        		<img src="<?php echo get_template_directory_uri(); ?>/images/icon_link.png" alt="" class=""/>
    				    	        	</div>
    			    	            </div>
    		 	    			</div>
    		 	    		</a>
    		 	    	</div>
    		 	    	
    		 	    	<?php
    		 	    		break;
    		 	    		//end external link
    		 	    		
    		 	    		case 'Portfolio Content':
    		 	    		default:
    		 	    	?>
    		 	    	<div class="portfolio195_shadow">
    		 	    		<a href="<?php echo get_permalink($portfolio_item->ID); ?>">
    		 	    			<img src="<?php echo $image_url[0]?>" alt="" class="portfolio_img"/>
    		 	    			<div class="portfolio195_overlay">
    			 	    			<div class="portfolio195_overlay_inner">
    				    	        	<h5><?php echo $portfolio_item->post_title; ?></h5>
    				    	        	<hr/>
    				    	        	<?php echo pp_substr($portfolio_item->post_excerpt, 80); ?>
    				    	        	<div class="portfolio_type_wrapper">
    				    	        		<img src="<?php echo get_template_directory_uri(); ?>/images/icon_link.png" alt="" class=""/>
    				    	        	</div>
    			    	            </div>
    		 	    			</div>
    		 	    		</a>
    		 	    	</div>
    		 	    	
    		 	    	<?php
    		 	    		break;
    		 	    		//end Portfolio Content
    		 	    		
    		 	    		case 'AJAX Portfolio Content':
    	        				
    	        				//Get portfolio gallery ID
    	        				$portfolio_gallery_id = get_post_meta($portfolio_item->ID, 'portfolio_gallery_id', true);
    	        			?>
    	        			<div class="portfolio195_shadow">
    	        				<a href="javascript:;" data-rel="<?php echo $portfolio_item->ID; ?>" class="ajax_portfolio_link">
    	        					<img src="<?php echo $image_url[0]?>" alt="" class="portfolio_img"/>
    	        					<div class="portfolio195_overlay">
    		        				    <div class="portfolio195_overlay_inner">
    					    	        	<h5><?php echo $portfolio_item->post_title; ?></h5>
    					    	        	<hr/>
    					    	        	<?php echo pp_substr($portfolio_item->post_excerpt, 80); ?>
    					    	        	<div class="portfolio_type_wrapper">
    					    	        		<img src="<?php echo get_template_directory_uri(); ?>/images/icon_link.png" alt="" class=""/>
    					    	        	</div>
    				    	            </div>
    	        					</div>
    	        				</a>
    	        			</div>
    	        			
    	        			<?php
    	        				break;
    	        				//end AJAX Portfolio Content
    		 	    		
    		 	    		case 'Image':
    		 	    	?>
    		 	    	<div class="portfolio195_shadow">
    		 	    		<a href="<?php echo $full_image_url[0]; ?>" class="img_frame">
    		 	    			<img src="<?php echo $image_url[0]?>" alt="" class="portfolio_img"/>
    		 	    			<div class="portfolio195_overlay">
    			 	    			<div class="portfolio195_overlay_inner">
    				    	        	<h5><?php echo $portfolio_item->post_title; ?></h5>
    				    	        	<hr/>
    				    	        	<?php echo pp_substr($portfolio_item->post_excerpt, 80); ?>
    				    	        	<div class="portfolio_type_wrapper">
    				    	        		<img src="<?php echo get_template_directory_uri(); ?>/images/icon_image.png" alt="" class=""/>
    				    	        	</div>
    			    	            </div>
    		 	    			</div>
    		 	    		</a>
    		 	    	</div>
    		 	    	
    		 	    	<?php
    		 	    		break;
    		 	    		//end image
    		 	    		
    		 	    		case 'Youtube Video':
    		 	    	?>
    		 	    	<div class="portfolio195_shadow">
    		 	    		<a href="#video_<?php echo $portfolio_video_id; ?>" class="lightbox_youtube">
    		 	    			<img src="<?php echo $image_url[0]?>" alt="" class="portfolio_img"/>
    		 	    			<div class="portfolio195_overlay">
    			 	    			<div class="portfolio195_overlay_inner">
    				    	        	<h5><?php echo $portfolio_item->post_title; ?></h5>
    				    	        	<hr/>
    				    	        	<?php echo pp_substr($portfolio_item->post_excerpt, 80); ?>
    				    	        	<div class="portfolio_type_wrapper">
    				    	        		<img src="<?php echo get_template_directory_uri(); ?>/images/icon_video.png" alt="" class=""/>
    				    	        	</div>
    			    	            </div>
    		 	    			</div>
    		 	    		</a>
    		 	    	</div>
    		        						
    		        	<div style="display:none;">
    		        	    <div id="video_<?php echo $portfolio_video_id; ?>" class="embed-container">
    		        	        
    		        	        <iframe title="YouTube video player" width="900" height="488" src="http://www.youtube.com/embed/<?php echo $portfolio_video_id; ?>?theme=dark&rel=0&wmode=transparent" frameborder="0" allowfullscreen></iframe>
    		        	        
    		        	    </div>	
    		        	</div>
    		        					
    		        	<?php
    		        	    break;
    		        	    //end youtube
    		        	
    		        		case 'Vimeo Video':
    		        	?>
    		        	<div class="portfolio195_shadow">
    		        	    <a href="#video_<?php echo $portfolio_video_id; ?>" class="lightbox_vimeo">
    		        	    	<img src="<?php echo $image_url[0]?>" alt="" class="portfolio_img"/>
    		        	    	<div class="portfolio195_overlay">
    			        	    	<div class="portfolio195_overlay_inner">
    				    	        	<h5><?php echo $portfolio_item->post_title; ?></h5>
    				    	        	<hr/>
    				    	        	<?php echo pp_substr($portfolio_item->post_excerpt, 80); ?>
    				    	        	<div class="portfolio_type_wrapper">
    				    	        		<img src="<?php echo get_template_directory_uri(); ?>/images/icon_video.png" alt="" class=""/>
    				    	        	</div>
    			    	            </div>
    		        	    	</div>
    		        	    </a>
    		        	</div>
    		        						
    		        	<div style="display:none;">
    		        	    <div id="video_<?php echo $portfolio_video_id; ?>" class="embed-container">
    		        	    
    		        	        <iframe src="http://player.vimeo.com/video/<?php echo $portfolio_video_id; ?>?title=0&byline=0&portrait=0&color=ffffff" width="900" height="506" frameborder="0"></iframe>
    		        	        
    		        	    </div>	
    		        	</div>
    		        					
    		        	<?php
    		        	    break;
    		        	    //end vimeo
    		        	    
    		        	    case 'Self-Hosted Video':
    		    				
    		    			//Get video URL
    						$portfolio_mp4_url = get_post_meta($portfolio_item->ID, 'portfolio_mp4_url', true);
    						$preview_image = wp_get_attachment_image_src($image_id, 'large', true);
    		        	?>
    		        	<div class="portfolio195_shadow">
    		        	    <a href="#video_self_<?php echo $key; ?>" class="lightbox_vimeo">
    		        	    	<img src="<?php echo $image_url[0]?>" alt="" class="portfolio_img"/>
    		        	    	<div class="portfolio195_overlay">
    			        	    	<div class="portfolio195_overlay_inner">
    				    	        	<h5><?php echo $portfolio_item->post_title; ?></h5>
    				    	        	<hr/>
    				    	        	<?php echo pp_substr($portfolio_item->post_excerpt, 80); ?>
    				    	        	<div class="portfolio_type_wrapper">
    				    	        		<img src="<?php echo get_template_directory_uri(); ?>/images/icon_video.png" alt="" class=""/>
    				    	        	</div>
    			    	            </div>
    		        	    	</div>
    		        	    </a>
    		        	</div>
    		        						
    		        	<div style="display:none;">
    			    	    <div id="video_self_<?php echo $key; ?>" class="embed-container">
    			    	    
    			    	        <div id="self_hosted_vid_<?php echo $key; ?>">JW Player goes here</div>
    					
    					    	<script type="text/javascript">
    					    		jwplayer("self_hosted_vid_<?php echo $key; ?>").setup({
    					    			flashplayer: "<?php echo get_template_directory_uri(); ?>/js/player.swf",
    					    			file: "<?php echo $portfolio_mp4_url; ?>",
    					    			image: "<?php echo $preview_image[0]; ?>",
    					    			width: 900,
    					    			height: 488,
    					    		});
    					    	</script>
    			    	        
    			    	    </div>	
    			    	</div>
    		        					
    		        	<?php
    		        	    break;
    		        	    //end self-hosted video
    		        	?>
    		        	
    		        	<?php
    		        	    }
    		        	    //end switch
    		        	?>
    		        	    
    		        	</div>
    		            
    		            <?php
    		        		
    		        		}
    		        		//End foreach loop
    		        		
    		            ?>
    		            
    		    </div>
    		<?php
    		    
    		}
    		//End if have portfolio items
    		?>
    		<br class="clear"/>
    		</div>
    		
    		<div class="sidebar_wrapper">
    		
    		    <div class="sidebar_top"></div>
    		
    		    <div class="sidebar">
    		    
    		    	<div class="content">
    		    	
    		    		<ul class="sidebar_widget">
    		    		<?php dynamic_sidebar($page_sidebar); ?>
    		    		</ul>
    		    	
    		    	</div>
    		
    		    </div>
    		    <br class="clear"/>
    		
    		    <div class="sidebar_bottom"></div>
    		</div>
    				
    <?php
    if(!isset($hide_header) OR !$hide_header)
    {
    ?>				
    		</div>
    		<!-- End main content -->
    					
    		<br class="clear"/><br/><br/>
    				
    	</div>
    			
    </div>
    <!-- End content -->
    				
    
    <?php get_footer(); ?>
    <?php
    }
    ?>

    #1886878

    Flobogo
    Modérateur
    Maître WordPress
    13132 contributions

    Il faut changer les lignes 82 et 83, à remplacer par :

    		'orderby' => 'date',
    	    	'order' => 'ASC',

    Si ça fonctionne, il faudra soit bien enregistrer cette modification de fichier « dans un coin » de votre ordi, soit mettre le fichier modifié dans un thème-enfant.

    #1886950

    guiflow
    Participant
    Initié WordPress
    6 contributions

    Merci pour ta réponse ! Je vais tester ça d’ici ce week-end, je te tiens au courant !

    Encore merci,

    Guillaume.

5 sujets de 1 à 5 (sur un total de 5)
  • Vous devez être connecté pour répondre à ce sujet.