Daily Digest Display post types

Hello, i would like my daily digest to display what post type the new posts are, either by headlining each list of new posts with the post type or by showing the post type on each new post. I tried editing the post.php template as the tooltip shows however the get_post_type() funtion doesnt seem to be working here even though the_title() function does work.
can you help me?

  • Luís

    Hi Marie ,

    Hope you're doing well today!

    If I understood well your question, you want to display the Post type close to the Title, something like:

    Post type : Post Title

    If yes, the code suggested by my teammate Jude should work, however, can you try:

    1) Using FTP access, go to "wp-content/plugins/subscribe-by-email/inc/mail-templates/views/" folder and download "post.php" file;

    2) Close to the line 25, you will find "the_title();", so try add this code before of if:

    <?php $post_type=get_post_type(); 
    
    			echo $post_type
    
    			?>
    
    			:

    3) Inside of your root theme folder, create another folder called "subscribe-by-email" and upload the file to inside of it, in order to override the original template file.

    Attached I sent the "post.php" template with these changes, if you want to give a look.

    Cheers, Luís

  • Marie

    okay, now we are back where we started :slight_smile: thank you for your thorough guide and the post.php template. This is exactly what i was doing but now we can be sure we are all on the same page. So I used your code, which uses the get_post_type() function that Jude said won't work, while in the loop. As far as i can tell if you use the get_post_type() function without a parameter it will just use the current global $post.
    Anyways the post type still doesn't show up in the preview which again makes me question whether the lorem Ipsum dummy posts have a post type at all?
    My preview now looks like the file I have attached.

  • Luís

    Hi Marie ,

    Hope you're doing well today!

    I think the "Preview" option only have dummy text and the code provided will not work in this "Preview".

    Maybe I am missing something here, but, have you made a "real" test with the code provided above or are you just checking the "Preview" option?

    I.E

    1) Subscribe one of your custom post types;

    2) Add a new post to this custom post type;

    3) Check the notification email received.

    In the Preview option, this is not working on my install too, the "Post Type" is empty, however, when I add a new post, the notification email have the custom post type name.

    Cheers, Luís

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.