Implementing categories into Subscribe by email plugin

I wonder how can I get help on implementing categories into your plugin “Subscribe by EMmail”
It’s not on WPMU anymore so l wonder whom to ask for help. This is not a feature of the plugin, but it can display the author.
So I assume, it also could pull the post category from database. This should be a small thing only for anybody who know how to do it.

I like to add the post category to the email that’s generated.

  • Pawel
    • Staff

    Hello Rob !

    Hope you’re having a good day!

    I’m not sure if I understand correctly, but if you want to include the categories in the email along with the author and the date, that should be possible!

    SBE uses a template system – you can see an explanation on how to use it on the top of the Subscriptions >> Settings page (the one about copying files from the plugin to your theme’s directory). The template of interest here is the post.php file. Once you have it copied correctly to the theme’s directory, you can change the line that says:

    
    <?php printf( __( 'by %s on %s', INCSUB_SBE_LANG_DOMAIN ), get_the_author(), get_the_date( $date_format ) ); ?>
    

    To:

    
    <?php printf( __( 'by %s on %s, in %s', INCSUB_SBE_LANG_DOMAIN ), get_the_author(), get_the_date( $date_format ), get_the_category_list(', ') ); ?>
    

    The above snippet will change the metadata section of the email to include a comma-separated list of categories (with links). You can actually use the get_the_category_list() functions in any place you want in that file, it doesn’t have to go in the metadata section.

    If you’re interested, here’s the official documentation for that function: https://developer.wordpress.org/reference/functions/get_the_category_list/

    Hope this helps!

    Kind regards,
    Pawel

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.