WordPress.org

Plugin Directory

Changeset 531151


Ignore:
Timestamp:
04/14/12 20:09:39 (2 years ago)
Author:
jeremyfelt
Message:

Add filters to allow themes and plugins to modify post title, content, and categories

These are somewhat outside of the scope of the plugin, but it seems like a nice thing to offer for those that want more flexibility when automatically creating stuff.

Updates to v0.6

Location:
automatic-featured-image-posts/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • automatic-featured-image-posts/trunk/automatic-featured-image-posts.php

    r528722 r531151  
    44Plugin URI: http://www.jeremyfelt.com/wordpress/plugins/automatic-featured-image-posts/ 
    55Description: Automatically creates a new post with an assigned featured image from every image upload. 
    6 Version: 0.5 
     6Version: 0.6 
    77Author: Jeremy Felt 
    88Author URI: http://www.jeremyfelt.com 
     
    287287        $current_user = wp_get_current_user(); 
    288288 
    289         $new_post_content = ''; 
     289        /* Allow other functions or themes to change the post title before creation. */ 
     290        $new_post_title = apply_filters( 'afip_new_post_title', get_the_title( $post_id ), $post_id ); 
     291 
     292        /* Allow other functions or themes to change the post categories before creation. */ 
     293        $new_post_category = apply_filters( 'afip_new_post_category', $new_post_category, $post_id ); 
     294 
     295        /* Allow other functions or themes to change the post content before creation. */ 
     296        $new_post_content = apply_filters( 'afip_new_post_content', '', $post_id ); 
    290297 
    291298        $new_post_id = wp_insert_post( array( 
    292             'post_title' => get_the_title( $post_id ), 
     299            'post_title' => $new_post_title, 
    293300            'post_content' => $new_post_content, 
    294301            'post_status' => $afip_options[ 'default_post_status' ], 
  • automatic-featured-image-posts/trunk/readme.txt

    r528722 r531151  
    66Requires at least: 3.2.1 
    77Tested up to: 3.4 
    8 Stable tag: 0.5 
     8Stable tag: 0.6 
    99 
    1010Automatic Featured Image Posts creates a new post with a Featured Image every time an image is uploaded. 
     
    2828    *  Other options are provided if registered by your theme 
    2929 
     30Filters are available for: 
     31 
     32*  'afip_new_post_title' = Allow other functions or themes to change the post title before creation. 
     33*  'afip_new_post_category' = Allow other functions or themes to change the post categories before creation. 
     34*  'afip_new_post_content' = Allow other functions or themes to change the post content before creation. 
     35 
    3036== Installation == 
    3137 
     
    4551= Can you put the images in post content instead of setting them as a featured image? = 
    4652 
    47 *  At this time, no. I spent quite a bit of time exploring a good way to do this, and I'm definitely open to it in the future, but it doesn't appear to be realistic right now. There are so many options for placing an image in your content, I'd hate to think I'd pick the perfect default. 
     53*  I can't, but you can with the included filters. 
     54    * Check out the [writeup on the new filters] (http://www.jeremyfelt.com/wordpress/2012/04/14/filters-in-aut…ed-image-posts "Filters in Automatic Featured Image Posts") 
    4855 
    4956== Screenshots == 
     
    5259 
    5360== Changelog == 
     61 
     62= 0.6 = 
     63*  Add filters to allow themes and plugins to change the post title, categories, and content before creation 
    5464 
    5565= 0.5 = 
     
    7787== Upgrade Notice == 
    7888 
     89= 0.6 = 
     90*  NEW - Filters added for post title, categories, and content. 
     91 
    7992= 0.5 = 
    8093*  NEW - Option to assign automatically created posts to registered post formats. 
Note: See TracChangeset for help on using the changeset viewer.