WordPress.org

Ready to get started?Download WordPress

Forums

Category Subscriptions
Custom taxonomies? (8 posts)

  1. Weblanced
    Member
    Posted 2 years ago #

    Hi,

    This looks like a great plugin, thanks for developing it. Will it work with custom taxonomies or only categories?

    Thanks

    Matt

    http://wordpress.org/extend/plugins/category-subscriptions/

  2. debsch
    Member
    Posted 2 years ago #

    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?

  3. debsch
    Member
    Posted 2 years ago #

    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!

    :)

  4. debsch
    Member
    Posted 2 years ago #

    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.

  5. debsch
    Member
    Posted 2 years ago #

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

  6. serviceall
    Member
    Posted 1 year ago #

    Thanks for that, debsch.

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

  7. debsch
    Member
    Posted 1 year ago #

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

  8. serviceall
    Member
    Posted 1 year ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic