WordPress.org

Forums

Easy Automatic Newsletter Lite
[Plugin: Easy Automatic Newsletter] Code Contribution: Add custom post_types to the newsletter (1 post)

  1. ildario
    Member
    Posted 2 years ago #

    This plugin is great but i'm using it on a website that has custom_post_types for "blogs" and then i had to figure out a way to include all custom post types (and exclude some that were created by Events Manager Plugin). Note that this will only work if you're sending all categories (because i've removed this filter)

    So, on the includes folder open ean-functions.php and about line 206 replace:

    $args = array(
    			'numberposts'     => -1,
    			'offset'          => 0,
    			'orderby'         => 'ID',
    			'order'           => 'ASC',
    			'post_type'       => 'post',
    			'post_status'     => 'publish',
    			'category'     	  => $settings['ean_categories']
    			);

    with this:

    /** Add all custom post types ***/
    	$argspt =array(
    		  'public'   => true,
    		  '_builtin' => false
    	);
    	$saida = 'names'; // names or objects, note names is the default
    	$operador = 'and'; // 'and' or 'or'
    	$tipo_post=get_post_types($argspt,$saida,$operador);
    	/** If you want to exclude some post type you can do it by adding post type slug on the following array, if you're not excluding anything you can remove this following line **/
    	$post_queri = array_diff($tipo_post, array("location"));
           /** Push post type "post" onto the array **/
    	array_push($post_queri, "post");	
    
    	$args = array(
    			'numberposts'     => -1,
    			'offset'          => 0,
    			'orderby'         => 'ID',
    			'order'           => 'ASC',
    /** here it comes, get all post_types **/
    			'post_type'       => $post_queri,
    			'post_status'     => 'publish'
    /** note that i've removed categories **/
    			);

    Hope it helps someone

    http://wordpress.org/extend/plugins/easy-automatic-newsletter/

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Easy Automatic Newsletter Lite
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic