WordPress.org

Ready to get started?Download WordPress

Forums

WP Catalogue
[resolved] Categories not working properly (4 posts)

  1. lucasbceo
    Member
    Posted 5 months ago #

    Hello,

    I have added all my categories in the right order on the admin panel:

    http://realmoveisescritorio.com.br/wp-content/themes/interior/img/categorias-backend.png

    And look how they Output! Makes no sense!

    http://realmoveisescritorio.com.br/wp-content/themes/interior/img/categorias-frontend.png

    It's all in Portuguese, so might be a bit confusing. But take the last category as example, Promoções. In backend you can see clearly it doesn't have any sub-categories, still there's 3 sub-categories for it in frontend.

    What's wrong?

    https://wordpress.org/plugins/wp-catalogue/

  2. Maeve Lander
    Member
    Plugin Author

    Posted 5 months ago #

    Not quite sure why this has happened, but looks like WordPress has decided to store the categories in a particular order (possibly alphabetical, but in English?)

    You could manually change the order in your SQL database, but if you don't mind installing a plugin the easiest solution would be Post Types Order plugin. This will add a nice drag and drop reorder function to all your custom post types including the WP Catalogue. So with this you can set the order however you like.

  3. lucasbceo
    Member
    Posted 5 months ago #

    Hey Maeve!

    That's odd, isn't it?

    I have deleted everything and started from scratch.

    Debugging now, seems that the plugin displays the categories in the order they are added, and doesn't take into consideration that it has a parent or not.

    If I add "Category1" first, then "Category2" as subcategory, it will display:

    Category2
    Category1

    You understand?
    Have something in mind I can try here, regarding the code?

    // generating sidebar
    		if($count>0){
    			$return_string .= '<li class="wpc-category ' . $class . '"><a href="'. get_option('catalogue_page_url') .'">Todos os Produtos</a></li>';
           		foreach($termsCatSort as $term){
    				//sub category class
    				 if($term->parent > 0){
    					$class2	= ' sub-cat';
    					}else{
    					$class2	= ' main-cat';
    					}
    				if($term_slug==$term->slug){
    				$class	=	'active-wpc-cat';
    			}else{
    				$class	=	'';
    			}
    			$return_string .=  '<li class="wpc-category '. $class .''. $class2 .'"><a href="'.get_term_link($term->slug, 'categoria').'">'. $term->name .'</a></li>';
    			}
    		}else{
    			$return_string .=  '<li class="wpc-category"><a href="#">Nenhuma Categoria</a></li>';
    		}
  4. Maeve Lander
    Member
    Plugin Author

    Posted 5 months ago #

    Ok yep that explains it. Actually that is exactly how it is meant to work - it lists in reverse order from what you uploaded, same as normal WP posts.

Reply

You must log in to post.

About this Plugin

About this Topic