Viewing 7 replies - 1 through 7 (of 7 total)
  • @klankentapper,

    If I am understanding you correctly this may be possible. Basically, you want to use a different email template depending upon the post category – is that right?

    If that is the case (and I am presuming you are maing per-post notifications) then you can use the ‘s2_email_template’ filter which is run when the template is collected. You could also access the Subscribe2 class and check the current category data and then return an appropriate filter in your code.

    This is untested but it’d look something like this:

    function category_template($template_text) {
    	global $mysubscribe2;
    	if ( stristr($mysubscribe2->post_cat_names, 'MY CATEGORY NAME' ) {
    		return "Some other template";
    	} elseif ( stristr($mysubscribe2->post_cat_names, 'MY SECOND CATEGORY NAME' ) {
    		return "Some other different template";
    	} else {
    		return $template_text;
    	}
    }
    add_filter('s2_email_template', 'category_template');

    Thread Starter klankentapper

    (@klankentapper)

    Indeed I want to use a different template upon the post category.

    I understand that it may be possible via API. I’m not familiair with Subscribe2 API’s so can you explain something more?

    Where should I use the code (function category_template) you’re referring to?

    @klankentapper,

    In the same way that WordPress has hooks that are used to change or extend functionality buy plugins like Subscribe2, Subscribe2 has hooks that allow it’s functionality to be changed or extended. So, basically you need to create a site specific plugin with code like that above to act as a plugin to Subscribe2 to deliver the features you want.

    Thread Starter klankentapper

    (@klankentapper)

    Ok, that’s clear.
    And in which map should the site specific plugin appear? Somewhere in the Subscribe2 maps?

    @klankentapper,

    Sorry, I don’t know what you mean by ‘map’.

    Thread Starter klankentapper

    (@klankentapper)

    Excuse me, I mean where should I store the site specific plugin? Somewhere in the Subscribe2 directories?

    @klankentapper,

    Ah, I see. No, keep it in it’s own folder in wp-content/plugins/ otherwise it’ll be erased when you update Subscribe2.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘template per category’ is closed to new replies.