Du befindest Dich im Archiv vom ABAKUS Online Marketing Forum. Hier kannst Du Dich für das Forum mit den aktuellen Beiträgen registrieren.

Kann mir da ein Wordpress Spezi nen Tipp geben?

Informationen & SEO Tipps zum Einsatz und Verwendung von Blog-, Wiki und Content Management Systemen wie Drupal, Typo3, Wordpress, Reddot, Joomla, Moin Moin, phpWiki sowie Shop-Systemen wie z.B. XT-Commerce, Magento, ePages, Intershop, 1&1 Shops.
Neues Thema Antworten
S0l0ng
PostRank 5
PostRank 5
Beiträge: 258
Registriert: 06.11.2008, 08:55

Beitrag von S0l0ng » 11.03.2012, 18:39

Also ich war im Netz auf der Suche nach einem Wordpress Plugin das einem Artikel anhand der Tags automatisch eine Kategorie zuweist. Dabei bin ich über folgenden Code gestolpert:

Code: Alles auswählen

   // Add a category to a post for each of selected tags the post already has.
   // Modify the $tag_categories array.  Use one tag name => one category name
   function mam_add_category ($post_id = 0) {
     if (!$post_id) return;
     $tag_categories = array ( // The tag names and the corresponding category name to add
       'info' => 'information',
       'INFO' => 'information',
          'search optimization' => 'SEO',
     );
     $post_tags = get_the_tags($post_id);
     foreach ($post_tags as $tag) {
       if ($tag_categories[$tag->name] ) {
         $cat_id = get_cat_ID($tag_categories[$tag->name]);
         if ($cat_id) {
           $result =  wp_set_post_terms( $post_id, $tags = $cat_id, $taxonomy = 'category', $append = true );
         }
       }
     }
   }
add_action('publish_post','mam_add_category');
?>
Leider war keine Anleitung dabei. Einer eine Idee wohin damit (wahrscheinlich irgendwo in der functions.php). Alternativ kennt vielleicht jemand von euch ein Plugin das den Job erledigt. Wie gesagt ich brauche eine Lösung um einem Artikel automatisch die passende Kategorie (bspw. nach Keywords im Titel) in die (vorhandene) passende Kategorie zuweist.

Danke schonmal für jeden Tipp
Contaxe, die Alternative zum Geldverdienen mit Foren!