Plugin Directory

Changeset 1263350


Ignore:
Timestamp:
10/11/2015 03:58:51 AM (10 years ago)
Author:
shankaranand12
Message:

wpcp-functions.php updated post type feature

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-content-protection/trunk/include/wpcp-functions.php

    r1187257 r1263350  
    4646 * Get available post type which is used for creating an posts.
    4747 */
    48    
    49    
    50    
    51     function wpcp_get_available_post_type() {
    52 
    53         global $wpdb;
     48function wpcp_get_available_post_type() {
     49       
     50        $list_posttype =array('page','post');
     51       
     52        $custom_post_types = get_post_types( array(
     53                // Set to FALSE to return only custom post types
     54                '_builtin' => FALSE,
     55                // Set to TRUE to return only public post types
     56                'public' => true
     57            ) );
     58       
     59        if($custom_post_types){
     60            foreach($custom_post_types as $post_type){
     61               $list_posttype[]= $post_type;       
     62            }
     63        }
     64      /*  global $wpdb;
    5465        $sql_posttype = "SELECT DISTINCT `post_type` FROM " . $wpdb->prefix . "posts WHERE `post_status`='publish' ";
    5566        $arr_posttype = $wpdb->get_results($sql_posttype);
    56         return $arr_posttype;
     67        return $arr_posttype;*/
     68        return $list_posttype;
    5769    }
    5870
Note: See TracChangeset for help on using the changeset viewer.