Status
Not open for further replies.

Ruriko

Active Member
692
2008
10
315
I'm trying to make an anime streaming site and I want to group categories by genre. Lets say the category can belong to several genres e.g actions,horror,mystery and another category belong to actions,horror,romance. How do I group categories into genres? Cause in the most basic structure, we group posts into category. Now i want group categories into genres

Then be able to display the category in the genre by a url such as http://www.domain.com/genre/actions and it will list all categories in it. Here's an example site that has this feature http://www.animetv.org/genres/shoujo/
 
Last edited:
9 comments
I can't create genres as the category and make series as sub category cause it'll end up having duplicates cause a series will contain multiple genres
 
Simple way to do this
Code:
[COLOR=#ff0000]<?php[/COLOR]
$args = array( 'post_type' => 'post',[COLOR=#0000cd] 'category__and' => array( 2, 3 )[/COLOR], 'posts_per_page' => 10 );
$custom_qry = new WP_Query($args);

if ($custom_qry->have_posts()) :
while ($custom_qry->have_posts()) : $custom_qry->the_post(); 
the_content();
 endwhile;
else : [COLOR=#ff0000]?>[/COLOR]
[COLOR=#008000]<h2>[/COLOR]Not Found[COLOR=#008000]</h2>[/COLOR]
[COLOR=#ff0000]<?php[/COLOR] endif;[COLOR=#ff0000]?>[/COLOR]

Notice: 'category__and' => array( 2, 3 ) , here 2 & 3 are Category Ids respectively
it says to wp query to combine both categories, so only the posts , belongs to category id 2 & category id 3 will be listed
 
Hallo,

what i see is a posttype anime and taxonomy gener.

you have 3 option to get this.
1. Register custom post type and taxonomy -> Here
2. Register taxonomy for post with gener name -> Here
3. Rename Categories to gener.

How to Rename code not testet
add_action('init', 'renameCategory');
function renameCategory() {
global $wp_taxonomies;

$cat = $wp_taxonomies['category'];
$cat->label = 'My Categories';
$cat->labels->singular_name = 'My Categorie';
$cat->labels->name = $cat->label;
$cat->labels->menu_name = $cat->label;
//…
}

To get categorie post list -> Here
 
Last edited:
This is the structure of anime site:

Anime Series Title (Category)
- Episode1 (Post)
- Episode2 (Post)
- Episode3 (Post)

Now if I were to make a taxonomy genre how will I group the categories so I can later make a page that will list categories that contain that specific genre.
I can't just make a custom post type cause the posts will act as episodes of the series (category)
 
Status
Not open for further replies.
Back
Top