• I’m running a movie related site. I use taxonomies to categorize movies into Actors, Directors, Year, Genre etc..

    For years, I use exact year like 2009, 2010.. But now I also want to add year spans by adding taxonomies like 2000’s, 1990’s etc..

    Is there an easy way to do add for every 2001, 2002, ….. , 2009 years an extra taxonomy of 2000’s ?

    Maybe can be done via sql ?
    Can anyone help me ?

    I hope my question is clear.. Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    What do you use to show the taxonomies? wp_list_categories()?

    Thread Starter eddai

    (@eddai)

    I’m using <?php echo get_the_term_list( $post->ID, 'tur', '', ', ', '' ); ?>

    not using categories, I use taxonomies..

    Moderator keesiemeijer

    (@keesiemeijer)

    Put this inside the loop:

    <?php
      // Get terms for post
      $terms = get_the_terms( $post->ID , 'tur' );
      if (!empty($terms)){
      $html='';
      // Loop over each item
        foreach( $terms as $term ) {
          $html .= '<a href="' . get_tag_link($term->term_id) . '" rel="tag">' . $term->name . "'s" .'</a>';
        }
      echo $html;
      }
    ?>

    Thread Starter eddai

    (@eddai)

    hi keesiemeijer, thanks for response,
    but don’t we have to run sql query ?

    my purpose is to add an “extra” taxonomy to default ones..

    lets say

    Movie Title: Gladiator
    Year: 2000

    Movie Title: Avatar
    Year: 2009

    my purpose is to add one more taxonomy as 2000’s to all posts belong to 2000-2009, so

    Movie Title: Gladiator
    Year: 2000, 2000’s

    Movie Title: Avatar
    Year: 2009, 2000’s

    but there are hunders of titles to add taxonomies.. so I’m looking for an easy way if possible..

    thanks

    Moderator keesiemeijer

    (@keesiemeijer)

    Maybe I don’t understand, but can’t you then just give your posts an extra custom “tur” taxonemy tag “2000’s”.

    Thread Starter eddai

    (@eddai)

    for new entries yes, I can easily add..
    but I already had posted over 600 entries.. that is why I’m looking for an easy way to batch add taxonomies..

    thanks for taking your time, much appreciated.

    Moderator keesiemeijer

    (@keesiemeijer)

    Ah yes, then you need to run a sql query or customize the functions that the wordpress core uses to insert tags in the database. That is a bit over my head. sorry

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Batch Add Taxonomies to Specific Posts’ is closed to new replies.