Not logged in. · Lost password · Registration disabled
Forum: Overview Files & Mods / Datein & Mods RSS
Userfunctions: @@categories lists the Categories of a post.
Morty (Administrator) #1
User title: Author
Member since Jun 2007 · 928 posts
Group memberships: Administratoren, Mitglieder
Show profile · Link to this post
Subject: Userfunctions: @@categories lists the Categories of a post.
  1. <?php
  2. function post_notificataion_uf_perPost($post_id){
  3.     //This is the easiest way to create array with a low possibility of errors
  4.     $rv = array();
  5.  
  6.     $cats = wp_get_post_categories($post_id);
  7.     $catnames = array();
  8.     foreach($cats as $cat){
  9.         $catnames[]= get_cat_name($cat);
  10.     }
  11.     $rv['@@categories'] = implode(", ", $catnames);
  12.  
  13.     return $rv;
  14. }
  15. ?>
The author has attached one file to this post:
userfunctions.php | Save   1.4 kBytes, downloaded 862 times
elev8 #2
Member since Dec 2008 · 6 posts
Group memberships: Mitglieder
Show profile · Link to this post
I got word of this being available,

I have now added a userfunctions.php with the code to my plugin directory.

I have the @@categories in the email_tempalte.

How do i now get the function working?
Morty (Administrator) #3
User title: Author
Member since Jun 2007 · 928 posts
Group memberships: Administratoren, Mitglieder
Show profile · Link to this post
Should be working right away.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum