Forums

Wysija Newsletters
[resolved] Including Custom Post Types hack? (10 posts)

  1. rendsvig84
    Member
    Posted 8 months 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 8 months 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 6 months 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 6 months 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 6 months 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 6 months 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 6 months 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 6 months 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 6 months 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 6 months ago #

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

Reply

You must log in to post.

About this Plugin

About this Topic