Support » Plugin: Category Subscriptions » [Plugin: Category Subscriptions] Custom taxonomies?

Viewing 7 replies - 1 through 7 (of 7 total)
  • debsch

    (@debsch)

    me tooo…. Also looking for a SIMPLE email newsletter for CUSTOM categories not just default ones. Category Subscriptions plugin is nice and simple, not too fussy, but is missing the custom taxonomies. Can they be added?

    debsch

    (@debsch)

    Cracked it! I think.

    What I’ve done is basically change the script to look for custom posts types instead of the regular POST.

    Sooooo…
    in wp-content/plugins/category-subscriptions/includes/category_subscriptions_class.php

    find & change
    $categories = get_categories(array(...
    to
    $categories = get_categories(array('hierarchical' => 1, 'hide_empty' => 0, 'taxonomy' => 'my-custom-categories',));

    This line appears twice. I changed both lines and on my user profile I now have a list of my CUSTOM categories instead of the regular categories. THAT was the easy bit. It took me a while to figure out the rest.

    find & change
    'post_type' => 'post'
    to
    'post_type' => 'my-custom-post-type'

    And lastly (this took me HOURS to figure out… because I’m a noobie)
    find & change
    $categories = wp_get_post_categories($post->ID);
    to

    $mycustomcategories = get_the_terms( $post->ID, 'my-custom-categories' );
    foreach( $mycustomcategories as $term ) {
    	$categories [0] = $term->term_taxonomy_id;
    	// Get rid of the other data stored in the object
    	unset($term);
    }

    … because wp_get_post_categories ONLY works with POSTS, so you have to use get_the_terms if you want to work with CUSTOM POSTS!

    After I did this I ran a test…
    and I received an email from the Category Subscriptions plugin informing me of a CUSTOM POST! YAY!

    🙂

    debsch

    (@debsch)

    OOPS!

    (edit)

    change..
    $categories = wp_get_post_categories($post->ID);
    to

    if ( 'post' == get_post_type() ) {
    		$categories = wp_get_post_categories($post->ID); ///// only works with POST types not CUSTOM POST types //////////
    	}
    	else {
    		$mycustomcategories = get_the_terms( $post->ID, 'event-categories' );
    		foreach( $mycustomcategories as $term ) {
    			$categories [0] = $term->term_taxonomy_id;
    			// Get rid of the other data stored in the object
    			unset($term);
    		}
    	}

    Obviously still a very buggy solution.

    debsch

    (@debsch)

    And it’s only working for immediate notifications not daily or weekly digests…. (yet)

    Thanks for that, debsch.

    Did you ever get it sorted for daily or weekly digests?

    No… after many hours I gave up and used a MailChimp plugin instead.

    Thanks for answering so quickly. I really appreciate it.

    Subscribing to categories isn’t anything I need. But my wife has a project she’s been working on and can’t get anything to work that allows her readers to subscribe to categories by choice. – Not all categories. Whatever category they wish to subscribe to.

    Are you saying it’s an option built into a MailChimp plugin? Can you share the name of that plugin?

    Thanks again!
    Dennis

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Category Subscriptions] Custom taxonomies?’ is closed to new replies.