Results 1 to 4 of 4

Thread: Automaticly create Custom Filed when Post is published

  1. #1
    Marketplace Seller mr_green's Avatar
    Join Date
    Aug 2010
    Posts
    953
    Thanks
    113
    Thanked 192 Times in 147 Posts

    Automaticly create Custom Filed when Post is published

    At the end of function.php just ad

    PHP Code:
    // add_action('publish_page', 'add_custom_field_automatically');
    add_action('publish_post''add_custom_field_automatically');
    function 
    add_custom_field_automatically($post_ID) {
        global 
    $wpdb;
        if(!
    wp_is_post_revision($post_ID)) {
            
    add_post_meta($post_ID'pubannonce''yes'true);
            
    add_post_meta($post_ID'ref''no'true);
        }

    When a post is published
    the custom field key --> "pubannonce" is create with value "yes"
    same as "ref" value "no"
    ....etc just repeat the lign
    PHP Code:
    add_post_meta($post_ID'CUSTOM KEY''CUSTOM VALUE'true); 
    Hope that help
    Best

  2. #2
    jomarkosabel's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    41,009
    Thanks
    170
    Thanked 3,409 Times in 3,280 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Please help our moderating team work more efficiently by not sending us support questions via PM. You can read more about how AppThemes support works here. However, you can send a PM to follow up and remind me if I missed your support request/thread.

    Thank you and have a nice day.

  3. #3
    Marketplace Seller mr_green's Avatar
    Join Date
    Aug 2010
    Posts
    953
    Thanks
    113
    Thanked 192 Times in 147 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Best

  4. #4
    Marketplace Seller mr_green's Avatar
    Join Date
    Aug 2010
    Posts
    953
    Thanks
    113
    Thanked 192 Times in 147 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Best

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Filed Tip Problem
    By jmarshall in forum Report ClassiPress Bugs
    Replies: 6
    Last Post: January 7th, 2011, 07:16 PM
  2. Create custom field to be only seen by admin?
    By Wamba in forum ClassiPress General Discussion
    Replies: 1
    Last Post: April 30th, 2010, 05:13 PM
  3. Create custom field to be only seen by admin?
    By Wamba in forum Help Using ClassiPress
    Replies: 0
    Last Post: December 31st, 1969, 07:00 PM
  4. Create Custom Unordered List?
    By gomeetpete in forum Help Using ClassiPress
    Replies: 0
    Last Post: December 31st, 1969, 07:00 PM