badget

Biggest Sale! Special Offer!

Get 30% discount on all of our single themes with this coupon code: #30%SALE

Hurry up! *Limited time offer*

Alphabetical Archive Listing

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #13084
    Kelsey
    Member

    I want to change my category archive pages to sort alphabetically rather than by published date. How should I do this? I have category-archive.php pages, but I’m not sure how to change the sort.

    #13104

    Hi kelsey,
    We don’t have this category-archive.php page. I think you have customise the code. You have designed our theme this way so you need code customization for it.
    To sort it alphabetically you need to pass an argument such as

    $args = array( 'posts_per_page' => -1, 'orderby'=> 'title', 'order' => 'ASC' );

    If you are unable then you may hire a developer to fix the issue.

    #13172
    Kelsey
    Member

    Thank you, this is helpful! Would there also be a way to randomize the archive listings?

    #13178

    Hi kelsey,
    To display in random order just try this 'orderby' => 'rand', This may help you
    follow this link too
    http://wordpress.org/support/topic/how-to-display-random-posts-from-a-given-category
    http://wordpress.org/support/topic/pull-a-random-category

    Thank you!

    #13189
    Kelsey
    Member

    Okay, I used archive.php to create my category archive pages. Where should I put the $args = array( 'posts_per_page' => -1, 'orderby'=> 'title', 'order' => 'ASC' ); code you provided above? I don’t see the argument that is calling the posts by date to replace it with.

    My code is:

    <?php
    /**
     * Displays the archive section of the theme.
     *
     * @package Theme Horse
     * @subpackage Clean_Retina_Pro
     * @since Clean Retina Pro 1.0
     */
    ?>
    
    <?php get_header(); ?>
    
    <?php
    	/** 
    	 * cleanretina_before_main_container hook
    	 */
    	do_action( 'cleanretina_before_main_container' );
    ?>
    
    <div id="container" class="wrapper clearfix">
    <p>
    Feel free to review our bakery pages!
    </p>
    	<?php
    		/** 
    		 * cleanretina_main_container hook
    		 *
    		 * HOOKED_FUNCTION_NAME PRIORITY
    		 *
    		 * cleanretina_content 10
    		 */
    		do_action( 'cleanretina_main_container' );
    	?>
    </div><!-- #container .wrapper -->
    
    <?php
    	/** 
    	 * cleanretina_after_main_container hook
    	 */
    	do_action( 'cleanretina_after_main_container' );
    	
    ?>
    
    <?php get_footer(); ?>
    #13241

    hi kelsey,

    We are using action hook. This all file is located inside your theme folder -> library -> structure -> content-extension.php
    All pages are controlled from this file.

    if ( ! function_exists( 'cleanretina_theloop_for_archive' ) ) :
    /**
     * Fuction to show the archive loop content.
     */
    function cleanretina_theloop_for_archive() {
    	global $post;
    	global $cleanretina_theme_options_settings;
    	$options = $cleanretina_theme_options_settings;
    
    	if( have_posts() ) {
    		while( have_posts() ) {
    			the_post();
    
    			do_action( 'cleanretina_before_post' );
    ?>
    	<section id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    		<article class="clearfix">
    
    			<?php do_action( 'cleanretina_before_post_header' ); ?>
    
    			<header class="entry-header">
        			<h2 class="entry-title">
        				<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute();?>"><?php the_title();?></a>
        			</h2><!-- .entry-title -->
        			<?php if (get_the_author() !=''){?>
                            	<div class="entry-meta">
    					<span class="by-author vcard author"><span class="fn"><?php _e( 'By', 'cleanretina' ); ?> <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>"><?php the_author(); ?></a></span></span>
                 	<span class="date updated"><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( get_the_time() ); ?>"><?php the_time( get_option( 'date_format' ) ); ?></a></span>
                 	<?php if( has_category() ) { ?>
                 		<span class="category"><?php the_category(', '); ?></span> 
                 	<?php } ?>
                 	<?php if ( comments_open() ) { ?>
                 		<span class="comments"><?php comments_popup_link( __( 'No Comments', 'cleanretina' ), __( '1 Comment', 'cleanretina' ), __( '% Comments', 'cleanretina' ), '', __( 'Comments Off', 'cleanretina' ) ); ?></span>
                 	<?php } ?>
             	</div><!-- .entry-meta -->
             	<?php } ?>
            		</header>
    
      			<?php do_action( 'cleanretina_after_post_header' ); ?>
    
      			<?php do_action( 'cleanretina_before_post_content' ); ?>
    
      			<?php
      			if( 'excerpt_display_one' == $options[ 'blog_display_type' ] || 'excerpt_display_two' == $options[ 'blog_display_type' ] ) {
    	  			if( 'excerpt_display_one' == $options[ 'blog_display_type' ] ) {
    	  				$featured_image_type = 'featured';
    	  			}
    	  			else {
    	  				$featured_image_type = 'featured-medium';
    	  			}
    
    				if( has_post_thumbnail() ) {
    					$image = '';        			
    		     		$title_attribute = apply_filters( 'the_title', get_the_title( $post->ID ) );
    		     		$image .= '<figure class="post-featured-image">';
    	     			$image .= '<a href="' . get_permalink() . '" title="'.the_title_attribute( 'echo=0' ).'">';
    	     			$image .= get_the_post_thumbnail( $post->ID, $featured_image_type, array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).'</a>';
    	     			$image .= '</figure>';
    
    		  			echo $image;
    		  		}
    	  			?>
    	  			<?php if (get_the_author() !=''){?>
    	  			<div class="entry-content clearfix">
    	    			<?php 
    	    				the_excerpt();
    	    				echo '<a class="readmore" href="' . get_permalink() . '" title="'.the_title( '', '', false ).'">'.$options[ 'post_excerpt_more_text' ].'</a>'; 
    	    			?>
    	  			</div><!-- .entry-content --> 
    	  			<?php } else{
    			the_content();	
    				} ?>
    
    		  		<?php
    			  	}
    			  	else {
    			  	?>
    			  		<div class="entry-content clearfix">
    			  			<?php
    			  			the_content( $options[ 'post_excerpt_more_text' ] );
    			  			wp_link_pages( array( 
    							'before'            => '<div style="clear: both;"></div><div class="pagination clearfix">'.__( 'Pages:', 'cleanretina' ),
    							'after'             => '</div>',
    							'link_before'       => '<span>',
    							'link_after'        => '</span>',
    							'pagelink'          => '%',
    							'echo'              => 1 
    	               ) ); 
    			  			?>
    			  		</div><!-- .entry-content -->
    			  	<?php
    		  	}
    		  	?>
    
      			<?php do_action( 'cleanretina_after_post_content' ); ?>
    
    		</article>
    	</section>
    	<hr/>
    <?php
    			do_action( 'cleanretina_after_post' );
    
    		}
    	}
    	else {
    		?>
    		<h1 class="entry-title"><?php _e( 'No Posts Found.', 'cleanretina' ); ?></h1>
          <?php
       }
    }
    endif;

    This argument you need to pass inside this function. View this link
    http://codex.wordpress.org/Function_Reference/get_categories

    You need to customise the code inside this function. If you are still unable then you may hire a developer to fix the issue.

    Thank you!

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.