• Hello. I need help. I have a custom page template and i have wp pagenavi and the Default Permalink mode work correctly but the Custom %Postname% doesn`t work. What is the problem?

    My Page template content:

    <?php
    /*
    /* Template Name: Portfolio page */
    
    get_header(); ?>
    
    	<?php
    	 // Get the sub-header from sub-header.php
    	 get_template_part( 'sub-header' );
    	?>
    
    	<!--BEGIN #container-->
    
    		<?php
    		 // Get the sub-header footer from sub-header_footer.php
    		 get_template_part( 'sub-header_footer' );
    
    		// If the user as set a number of items per page...
    		if( get_post_meta($post->ID, "_page_portfolio_num_items_page", $single = true) != '' ) {
    			$items_per_page = get_post_meta($post->ID, "_page_portfolio_num_items_page", $single = true);
    		} else { // else don't paginate
    			$items_per_page = 9999;
    		}
    
    		// The selected categories to show
    		$cats = get_post_meta($post->ID, "_page_portfolio-types", $single = true);
    		?>
    
    		<!--BEGIN #content-->
    		<div id="portfolio">  
    
            	<div class="portfolio-content"><?php the_content(); ?></div>
    
            	<?php
    			if( $cats == '' ) {
    				echo '<div class="portfolio-content"><p>No categories have been selected for this portfolio page. Please login to your WordPress Admin area and set the categories you want to show by editing this page and setting one or more categories in the multi checkbox field "Portfolio Categories".</p></div>';
    			} else {
    				// If the user hasn't set a number of items per page, then use JavaScript filtering
    				if( $items_per_page == 9999 ) :
    			?>
                    <span class="portfolio-browse"><?php _e( 'browse:', 'unisphere' ); ?></span>
    
                    <ul class="portfolio-filters">
                    	<li class="all"><a href="#"><?php _e( 'All', 'unisphere' ); ?></a>
                    	<?php
                    	// display only the selected portfolio categories
                    	$cats_array = explode( ",", $cats );
    
                        // list selected terms in the portfolio_category taxonomy
    					foreach ($cats_array as $cat) {
    						$tax_term = get_term( $cat, 'portfolio-types' );
    						echo '<li class="' . $tax_term->slug . '">' . '<a href="#">' . $tax_term->name . '</a>';
    					}
    					?>
    
                    <div class="clearfix"></div>
    
                    <?php endif; ?>
    
                    <div id="portfolio">
        			<h2 class="page-title"><?php the_title(); ?></h2>
                        <?php
                            // because WordPress doesn't yet provide an API for querying multiple terms in a taxonomy
                            // we have to use a not so elegant solution: query just the posts in the selected terms
                            $portfolio_posts_to_query = get_objects_in_term( explode( ",", $cats ), 'portfolio-types');
                            $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
                            $wp_query = new WP_Query( array( 'post_type' => 'portfolio', 'post__in' => $portfolio_posts_to_query, 'paged' => $paged, 'showposts' => $items_per_page ) );
                            while ($wp_query->have_posts()) : $wp_query->the_post();
    
                                $custom = get_post_custom($post->ID);
    
                                // Get the portfolio item categories
                                $cats = wp_get_object_terms($post->ID, 'portfolio-types');
    
                                // If no category was assigned, don't show the item
                                if ( $cats ) :
    								$cat_slugs = '';
    								foreach( $cats as $cat ) {
    									$cat_slugs .= $cat->slug . ",";
    								}
    								$cat_slugs = substr($cat_slugs, 0, -1);
                        ?>
                                    			<?php wp_reset_query(); ?>
    					<div class="portfolio-item">
            			<p class="project-name"><b>Project:</b> <?php the_title(); ?></p>
                		<a>">More Details »</a>
                		<div class="portfolio-img-bg">
                			<a>"><?php echo portofoliu_thumb(); ?> </a>
                		</div><!--end post-img-bg -->
            		</div><!--end portfolio-item-->
                            <?php endif; ?>
                        <?php endwhile; ?>
                    </div>
    
    			<div class="clearfix"></div>
    				<?php
                    // If the user has set a number of items per page, then display pagination
                    if( $items_per_page != 9999 ) {
                        echo '<div class="line"></div>';
                        // Show the pagination from navigation.php
                        get_template_part( 'navigation' );
                    }
    			} ?>
    
    		<!--END #content-->
    		</div>
    
    	<!--END #container-->
    	</div>
    
    <?php get_footer(); ?>

    [please mark any posted code by following the forum guidelines]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Wp page navi not working. Help me please !’ is closed to new replies.