WordPress.org

Forums

MailPoet Newsletters
[resolved] [Plugin: Wysija Newsletters] Including Custom Post Types hack? (14 posts)

  1. rendsvig84
    Member
    Posted 2 years ago #

    Hi!

    I've seen that custom post type integration is mentioned as a future development.

    Is there a chance that some ad-hoc method has been developed at this point already?

    I have only one custom post type I want included among the posts send out by the newsletter, and I do not mind messing with code (if properly guided ;) )

    http://wordpress.org/extend/plugins/wysija-newsletters/

  2. Ben
    Member
    Plugin Author

    Posted 2 years ago #

    Hi,

    Nothing has been developed at the time, but it's high in our list.
    Yet if you're in hurry to get that, you can hack the plugin yourself : go to wysija-newsletters/controllers/ajax/campaigns.php and modify the function getarticles.

    Hope this helps,

    CHeers,
    Ben

  3. lilqhgal
    Member
    Posted 2 years ago #

    Hi Ben,

    I changed the getarticles function by modifying the code below:

    if(isset($_REQUEST['search'])){
    
    			$querystr = "SELECT $wpdb->posts.ID , $wpdb->posts.post_title, $wpdb->posts.post_content, $wpdb->posts.post_excerpt
    
    			FROM $wpdb->posts
    
    			WHERE $wpdb->posts.post_title like '%".addcslashes(mysql_real_escape_string($_REQUEST['search'],$wpdb->dbh), '%_' )."%'
    
    			AND $wpdb->posts.post_status = 'publish'
    
    			AND $wpdb->posts.post_type = 'post'
    
    			OR $wpdb->posts.post_title like '%".addcslashes(mysql_real_escape_string($_REQUEST['search'],$wpdb->dbh), '%_' )."%'
    
    			AND $wpdb->posts.post_status = 'publish'
    
    			AND $wpdb->posts.post_type = 'horse'
    
    			ORDER BY $wpdb->posts.post_date DESC
    
    			LIMIT 0,30";

    (my custom post type is called "horse") ... This code doesn't seem to do anything. I don't see that added anywhere in the drag-and-drop newsletter creator, or anywhere else for that matter. Did I get it wrong? Thanks for the help!

  4. Martin
    Member
    Posted 2 years ago #

    I'm no coder but I can see an obvious line that would need to be changed - line 6 has another reference to the post type which would need to be changed to horse.

  5. Ben
    Member
    Plugin Author

    Posted 2 years ago #

    as of version 2.1.6 no need to hack the plugin for CPT support anymore.
    Try it and don't forget to give us feedback on support.wysija.com
    CHeers,
    Ben

  6. Martin
    Member
    Posted 2 years ago #

    Good one Ben

    I was wondering whether there's a way to trigger an auto newsletter for a custom post type ONLY when a new post for that custom post type is published?

    My wife runs her own site for her artwork and would like to send updates for new published work, for only new portfolio items.

    Is this something that can be done now or needed functionality required?

  7. Ben
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks Martin,
    Yes it should work now.
    The same way it was working for standard posts.
    Simply select the post you want in your filters for Automated posts, see the screenshot here:
    http://support.wysija.com/files/2012/11/custom_post_type_automatic.png

  8. Martin
    Member
    Posted 2 years ago #

    Cool Ben,

    Is there any reason why I'm unable to filter on Category like I can for 'Posts' post type?

    I'd like to avoid sending out emails for when an artwork is moved from 'Available' to 'Sold' and I see the example the newsletter is using is one from 'Sold' - this newsletter is only for Available which is a category for this custom post type.

    Maybe this is a typo in the code.

  9. lilqhgal
    Member
    Posted 2 years ago #

    Is there a way to include a different pre-generated photo size? Like a thumbnail or a custom size set in the functions file? Seems like it's pulling the large image (?) which might cause some emails to take a long time to be sent.

  10. lilqhgal
    Member
    Posted 2 years ago #

    BTW, THANK YOU for this update!!! awesomesauce!!!!

  11. jockhip12
    Member
    Posted 1 year ago #

    Hi Ben,

    The custom posts problem still persists. Can you help us please to change the get_articles() function such that the custom posts will be considered.

    Thanks
    jockhip12

  12. MailPoet Staff
    Member
    Plugin Author

    Posted 1 year ago #

    Jockship, please get in touch via our site:

    http://support.wysija.com/feedback/

    Make sure you redescribe exactly what exactly you're looking for.

  13. ahmadajmi
    Member
    Posted 1 year ago #

    If any body want to set custom post type to be the default in the popup modal ,

    Just change the $cpt variable to your custom post, line 288 - controllers/ajax/campaigns.php

    my custom post type is called "machine"

    $query_cpt = ' '.$wpdb->posts.'.post_type="'.$cpt.'"';

    to

    $query_cpt = ' '.$wpdb->posts.'.post_type="machine"';

  14. 10tklz
    Member
    Posted 1 year ago #

    I'm not sure if I should maybe make this a new separate forum entry, but it's related so here goes: What about custom taxonomies? Is it just as easy to add those?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • MailPoet Newsletters
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic