function WP_Posts_List_Table() {
		global $post_type_object, $post_type, $wpdb;

		if ( !isset( $_REQUEST['post_type'] ) )
			$post_type = 'post';
		elseif ( in_array( $_REQUEST['post_type'], get_post_types( array( 'show_ui' => true ) ) ) )
			$post_type = $_REQUEST['post_type'];
		else
			wp_die( __( 'Invalid post type' ) );
		$_REQUEST['post_type'] = $post_type;

		$post_type_object = get_post_type_object( $post_type );

		if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) {
			$this->user_posts_count = $wpdb->get_var( $wpdb->prepare( "
				SELECT COUNT( 1 ) FROM $wpdb->posts
				WHERE post_type = %s AND post_status NOT IN ( 'trash', 'auto-draft' )
				AND post_author = %d
			", $post_type, get_current_user_id() ) );

			if ( $this->user_posts_count && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) && empty( $_REQUEST['show_sticky'] ) )
				$_GET['author'] = get_current_user_id();
		}

		if ( 'post' == $post_type && $sticky_posts = get_option( 'sticky_posts' ) ) {
			$sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) );
			$this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status != 'trash' AND ID IN ($sticky_posts)", $post_type ) );
		}

		parent::WP_List_Table( array(
			'plural' => 'posts',
		) );
	}
 function action_init()
 {
     //syncing must wait until after init so
     //post types that support comments
     $filt_post_types = array();
     $all_post_types = get_post_types();
     foreach ($all_post_types as $post_type) {
         if (post_type_supports($post_type, 'comments')) {
             $filt_post_types[] = $post_type;
         }
     }
     Jetpack_Sync::sync_posts(__FILE__, array('post_types' => $filt_post_types, 'post_stati' => array('publish')));
     Jetpack_Sync::sync_comments(__FILE__, array('post_types' => $filt_post_types, 'post_stati' => array('publish'), 'comment_stati' => array('approve', 'approved', '1', 'hold', 'unapproved', 'unapprove', '0', 'spam', 'trash')));
     if (defined('DOING_AJAX') && DOING_AJAX) {
         return;
     }
     if (!has_filter('show_admin_bar', '__return_true') && !is_user_logged_in()) {
         return;
     }
     if (!self::current_browser_is_supported()) {
         return;
     }
     add_action('admin_bar_menu', array(&$this, 'admin_bar_menu'), 120);
     add_action('wp_head', array(&$this, 'styles_and_scripts'), 120);
     add_action('admin_head', array(&$this, 'styles_and_scripts'));
 }
Beispiel #3
0
/**
 * Remove the Person metabox from all post types.
 */
function remove_person_meta_box()
{
    $post_types = get_post_types('', 'names');
    foreach ($post_types as $post_type) {
        remove_meta_box('tagsdiv-person', '' . $post_type . '', 'side');
    }
}
/**
 * Register a new meta box to the post or page edit screen, so that the user can add landing section
 * on a per-post or per-page basis.
 */
function cuttz_add_landing_sections_meta_box()
{
    if (!current_theme_supports('cuttz-landing-sections')) {
        return;
    }
    global $post;
    if (get_option('show_on_front') == 'page') {
        $posts_page_id = get_option('page_for_posts');
        if ($posts_page_id == $post->ID) {
            add_action('edit_form_after_title', 'cuttz_landing_section_posts_notice');
            return;
        }
    }
    if (in_array('woocommerce/woocommerce.php', get_option('active_plugins'))) {
        if ($post->ID == wc_get_page_id('shop')) {
            add_action('edit_form_after_title', 'cuttz_landing_section_shop_notice');
            return;
        }
    }
    $context = 'normal';
    $priority = 'high';
    foreach ((array) get_post_types(array('public' => true)) as $type) {
        if (post_type_supports($type, 'cuttz-landing-sections')) {
            add_meta_box('landing-sections', __('Cuttz Landing Sections', 'cuttz-framework'), 'cuttz_landing_sections_box', $type, $context, $priority);
        }
    }
}
function enlightenment_templates()
{
    $templates = array('error404' => array('name' => __('404', 'enlightenment'), 'conditional' => 'is_404', 'type' => 'special'), 'search' => array('name' => __('Search', 'enlightenment'), 'conditional' => 'is_search', 'type' => 'archive'), 'blog' => array('name' => __('Blog', 'enlightenment'), 'conditional' => 'is_home', 'type' => 'post_type_archive'), 'post' => array('name' => __('Post', 'enlightenment'), 'conditional' => 'is_single', 'type' => 'post_type'), 'page' => array('name' => __('Page', 'enlightenment'), 'conditional' => 'is_page', 'type' => 'post_type'), 'author' => array('name' => __('Author', 'enlightenment'), 'conditional' => 'is_author', 'type' => 'archive'), 'date' => array('name' => __('Date', 'enlightenment'), 'conditional' => 'is_date', 'type' => 'archive'), 'category' => array('name' => __('Category', 'enlightenment'), 'conditional' => 'is_category', 'type' => 'archive'), 'post_tag' => array('name' => __('Tag', 'enlightenment'), 'conditional' => 'is_tag', 'type' => 'archive'), 'comments' => array('name' => __('Comments', 'enlightenment'), 'conditional' => 'is_singular', 'hooks' => array_keys(enlightenment_comments_hooks()), 'type' => 'special'));
    $post_types = get_post_types(array('has_archive' => true), 'objects');
    foreach ($post_types as $name => $post_type) {
        $templates[$name . '-archive'] = array('name' => sprintf(__('%1$s Archive', 'enlightenment'), $post_type->labels->name), 'conditional' => array('is_post_type_archive', $name), 'type' => 'post_type_archive');
    }
    $post_types = get_post_types(array('publicly_queryable' => true), 'objects');
    foreach ($post_types as $name => $post_type) {
        $templates[$name] = array('name' => $post_type->labels->singular_name, 'conditional' => array('is_singular', $name), 'type' => 'post_type');
    }
    $taxonomies = get_taxonomies(array('public' => true), 'objects');
    unset($taxonomies['post_format']);
    unset($taxonomies['category']);
    unset($taxonomies['post_tag']);
    foreach ($taxonomies as $name => $taxonomy) {
        $templates[$name] = array('name' => $taxonomy->labels->singular_name, 'conditional' => array('is_tax', $name), 'type' => 'taxonomy');
    }
    $default_hooks = array_keys(enlightenment_template_hooks());
    foreach ($templates as $name => $template) {
        if (!isset($template['hooks']) || empty($template['hooks'])) {
            $templates[$name]['hooks'] = $default_hooks;
        }
    }
    return apply_filters('enlightenment_templates', $templates);
}
Beispiel #6
0
 function folio_remove_vc_custom_teaser()
 {
     $post_types = get_post_types('', 'names');
     foreach ($post_types as $post_type) {
         remove_meta_box('vc_teaser', $post_type, 'side');
     }
 }
Beispiel #7
0
function hocwp_meta_box_side_image($args = array())
{
    global $pagenow;
    if ('post-new.php' == $pagenow || 'post.php' == $pagenow) {
        $id = hocwp_get_value_by_key($args, 'id', 'secondary_image_box');
        $title = hocwp_get_value_by_key($args, 'title', __('Secondary Image', 'hocwp-theme'));
        $post_types = hocwp_get_value_by_key($args, 'post_type');
        if ('all' == $post_types) {
            $post_types = array();
            $types = get_post_types(array('public' => true), 'objects');
            hocwp_exclude_special_post_types($types);
            foreach ($types as $key => $object_type) {
                $post_types[] = $key;
            }
        }
        $post_types = hocwp_sanitize_array($post_types);
        $field_id = hocwp_get_value_by_key($args, 'field_id', 'secondary_image');
        $post_types = apply_filters('hocwp_post_type_user_large_thumbnail', $post_types);
        if (!hocwp_array_has_value($post_types)) {
            return;
        }
        $meta = new HOCWP_Meta('post');
        $meta->set_post_types($post_types);
        $meta->set_id($id);
        $meta->set_title($title);
        $meta->set_context('side');
        $meta->set_priority('low');
        $field_args = array('id' => $field_id, 'field_callback' => 'hocwp_field_media_upload_simple');
        $field_name = hocwp_get_value_by_key($args, 'field_name', $field_id);
        $field_args['name'] = $field_name;
        $meta->add_field($field_args);
        $meta->init();
    }
}
 public static function search_terms($request = null)
 {
     $response = (object) array('status' => false, 'message' => __('Your request has failed', 'fakerpress'), 'results' => array(), 'more' => true);
     if (!Admin::$is_ajax && is_null($request) || !is_user_logged_in()) {
         return Admin::$is_ajax ? exit(json_encode($response)) : $response;
     }
     $request = (object) wp_parse_args($request, array('search' => isset($_POST['search']) ? $_POST['search'] : '', 'post_type' => isset($_POST['post_type']) ? $_POST['post_type'] : null, 'page' => absint(isset($_POST['page']) ? $_POST['page'] : 0), 'page_limit' => absint(isset($_POST['page_limit']) ? $_POST['page_limit'] : 10)));
     if (is_null($request->post_type) || empty($request->post_type)) {
         $request->post_type = get_post_types(array('public' => true));
     }
     $response->status = true;
     $response->message = __('Request successful', 'fakerpress');
     preg_match('/@(\\w+)/i', $request->search, $response->regex);
     if (!empty($response->regex)) {
         $request->search = array_filter(array_map('trim', explode('|', str_replace($response->regex[0], '|', $request->search))));
         $request->search = reset($request->search);
         $taxonomies = $response->regex[1];
     } else {
         $taxonomies = get_object_taxonomies($request->post_type);
     }
     $response->taxonomies = get_object_taxonomies($request->post_type, 'objects');
     $response->results = get_terms((array) $taxonomies, array('hide_empty' => false, 'search' => $request->search, 'number' => $request->page_limit, 'offset' => $request->page_limit * ($request->page - 1)));
     if (empty($response->results) || count($response->results) < $request->page_limit) {
         $response->more = false;
     }
     return Admin::$is_ajax ? exit(json_encode($response)) : $response;
 }
function TOPluginMenu()
{
    include TOPATH . '/include/interface.php';
    include TOPATH . '/include/terms_walker.php';
    include TOPATH . '/include/options.php';
    add_options_page('Taxonomy Terms Order', '<img class="menu_pto" src="' . TOURL . '/images/menu-icon.gif" alt="" />' . __('Taxonomy Terms Order', 'to'), 'manage_options', 'to-options', 'to_plugin_options');
    $options = get_option('tto_options');
    if (!isset($options['level'])) {
        $options['level'] = 8;
    }
    //put a menu within all custom types if apply
    $post_types = get_post_types();
    foreach ($post_types as $post_type) {
        //check if there are any taxonomy for this post type
        $post_type_taxonomies = get_object_taxonomies($post_type);
        foreach ($post_type_taxonomies as $key => $taxonomy_name) {
            $taxonomy_info = get_taxonomy($taxonomy_name);
            if ($taxonomy_info->hierarchical !== TRUE) {
                unset($post_type_taxonomies[$key]);
            }
        }
        if (count($post_type_taxonomies) == 0) {
            continue;
        }
        if ($post_type == 'post') {
            add_submenu_page('edit.php', __('Taxonomy Order', 'to'), __('Taxonomy Order', 'to'), 'level_' . $options['level'], 'to-interface-' . $post_type, 'TOPluginInterface');
        } else {
            add_submenu_page('edit.php?post_type=' . $post_type, __('Taxonomy Order', 'to'), __('Taxonomy Order', 'to'), 'level_' . $options['level'], 'to-interface-' . $post_type, 'TOPluginInterface');
        }
    }
}
function stats_load()
{
    global $wp_roles;
    Jetpack::enable_module_configurable(__FILE__);
    Jetpack::module_configuration_load(__FILE__, 'stats_configuration_load');
    Jetpack::module_configuration_head(__FILE__, 'stats_configuration_head');
    Jetpack::module_configuration_screen(__FILE__, 'stats_configuration_screen');
    // Tell HQ about changed posts
    $post_stati = get_post_stati(array('public' => true));
    // All public post stati
    $post_stati[] = 'private';
    // Content from private stati will be redacted
    Jetpack_Sync::sync_posts(__FILE__, array('post_types' => get_post_types(array('public' => true)), 'post_stati' => $post_stati));
    // Generate the tracking code after wp() has queried for posts.
    add_action('template_redirect', 'stats_template_redirect', 1);
    add_action('wp_head', 'stats_admin_bar_head', 100);
    add_action('wp_head', 'stats_hide_smile_css');
    add_action('jetpack_admin_menu', 'stats_admin_menu');
    // Map stats caps
    add_filter('map_meta_cap', 'stats_map_meta_caps', 10, 4);
    if (isset($_GET['oldwidget'])) {
        // Old one.
        add_action('wp_dashboard_setup', 'stats_register_dashboard_widget');
    } else {
        add_action('admin_init', 'stats_merged_widget_admin_init');
    }
    add_filter('jetpack_xmlrpc_methods', 'stats_xmlrpc_methods');
    add_filter('pre_option_db_version', 'stats_ignore_db_version');
}
 function get_page_ancestors()
 {
     $ancestors = get_option("scoper_page_ancestors");
     if (is_array($ancestors)) {
         return $ancestors;
     }
     $ancestors = array();
     global $wpdb;
     if (awp_ver('3.0')) {
         $post_types = get_post_types(array('hierarchical' => true, 'public' => true));
         $where = "WHERE post_type IN ('" . implode("','", $post_types) . "') AND post_status != 'auto-draft'";
     } else {
         $where = "WHERE post_type != 'revision' AND post_type != 'post' AND post_status != 'auto-draft'";
     }
     if ($pages = scoper_get_results("SELECT ID, post_parent FROM {$wpdb->posts} {$where}")) {
         $parents = array();
         foreach ($pages as $page) {
             if ($page->post_parent) {
                 $parents[$page->ID] = $page->post_parent;
             }
         }
         foreach ($pages as $page) {
             $ancestors[$page->ID] = ScoperAncestry::_walk_ancestors($page->ID, array(), $parents);
             if (empty($ancestors[$page->ID])) {
                 unset($ancestors[$page->ID]);
             }
         }
         update_option("scoper_page_ancestors", $ancestors);
     }
     return $ancestors;
 }
Beispiel #12
0
function sharing_add_meta_box()
{
    $post_types = get_post_types(array('public' => true));
    foreach ($post_types as $post_type) {
        add_meta_box('sharing_meta', __('Sharing', 'jetpack'), 'sharing_meta_box_content', $post_type, 'advanced', 'high');
    }
}
Beispiel #13
0
 public function column()
 {
     global $wp_version;
     $is_wp_v3_1 = version_compare($wp_version, '3.0.999', '>');
     add_filter('manage_media_columns', array($this, 'add'));
     add_action('manage_media_custom_column', array($this, 'value'), 10, 2);
     add_filter('manage_link-manager_columns', array($this, 'add'));
     add_action('manage_link_custom_column', array($this, 'value'), 10, 2);
     add_action('manage_edit-link-categories_columns', array($this, 'add'));
     add_filter('manage_link_categories_custom_column', array($this, 'returnvalue'), 10, 3);
     foreach (get_taxonomies() as $taxonomy) {
         add_action("manage_edit-{$taxonomy}_columns", array($this, 'add'));
         add_filter("manage_{$taxonomy}_custom_column", array($this, 'returnvalue'), 10, 3);
         if ($is_wp_v3_1) {
             add_filter("manage_edit-{$taxonomy}_sortable_columns", array($this, 'add'));
         }
     }
     foreach (get_post_types() as $post_type) {
         add_action("manage_edit-{$post_type}_columns", array($this, 'add'));
         add_filter("manage_{$post_type}_posts_custom_column", array($this, 'value'), 10, 3);
         if ($is_wp_v3_1) {
             add_filter("manage_edit-{$post_type}_sortable_columns", array($this, 'add'));
         }
     }
     add_action('manage_users_columns', array($this, 'add'));
     add_filter('manage_users_custom_column', array($this, 'returnvalue'), 10, 3);
     if ($is_wp_v3_1) {
         add_filter("manage_users_sortable_columns", array($this, 'add'));
     }
     add_action('manage_edit-comments_columns', array($this, 'add'));
     add_action('manage_comments_custom_column', array($this, 'value'), 10, 2);
     if ($is_wp_v3_1) {
         add_filter("manage_edit-comments_sortable_columns", array($this, 'add'));
     }
 }
function wpv_post_types_checkboxes($view_settings)
{
    $post_types = get_post_types(array('public' => true), 'objects');
    // remove any post types that don't exist any more.
    foreach ($view_settings['post_type'] as $type) {
        if (!isset($post_types[$type])) {
            unset($view_settings['post_type'][$type]);
        }
    }
    ?>
        <ul style="padding-left:30px;">
            <?php 
    foreach ($post_types as $p) {
        ?>
                <?php 
        $checked = @in_array($p->name, $view_settings['post_type']) ? ' checked="checked"' : '';
        ?>
                <li><label><input type="checkbox" name="_wpv_settings[post_type][]" value="<?php 
        echo $p->name;
        ?>
" <?php 
        echo $checked;
        ?>
 onclick="wpv_filter_vmenu_items();" />&nbsp;<?php 
        echo $p->labels->name;
        ?>
</label></li>
            <?php 
    }
    ?>
        </ul>
    <?php 
}
 /**
  * Add custom meta boxes to the nav menu editor
  */
 public static function add_meta_boxes()
 {
     static::$post_types = get_post_types(['has_archive' => true], 'object');
     if (!empty(static::$post_types)) {
         add_meta_box('add-archives', __('Archives', 'boilerplate'), [get_called_class(), 'archives_meta_box'], 'nav-menus', 'side', 'default');
     }
 }
function super_sticky_set_post_types()
{
    $post_types = get_post_types(array('_builtin' => false, 'public' => true), 'names');
    if (!empty($post_types)) {
        $checked_post_types = super_sticky_post_types();
        foreach ($post_types as $post_type) {
            ?>
			<div><input type="checkbox" id="<?php 
            echo esc_attr('post_type_' . $post_type);
            ?>
" name="sticky_custom_post_types[]" value="<?php 
            echo esc_attr($post_type);
            ?>
" <?php 
            checked(in_array($post_type, $checked_post_types));
            ?>
 /> <label for="<?php 
            echo esc_attr('post_type_' . $post_type);
            ?>
"><?php 
            echo esc_html($post_type);
            ?>
</label></div><?php 
        }
    } else {
        echo '<p>' . __('No public custom post types found.') . '</p>';
    }
}
 public static function add_meta_boxes()
 {
     $post_types = get_post_types(array('public' => true));
     foreach ($post_types as $post_type) {
         add_meta_box('sbg_box', __('Sidebar', 'Avada'), array('sidebar_generator', 'edit_form'), $post_type, 'side');
     }
 }
 /**
  * Enqueue Function.
  * If this field requires any scripts, or css define this function and register/enqueue the scripts/css
  * @return void
  */
 public function enqueue()
 {
     $post_types = get_post_types(array('_builtin' => false));
     /** @var array $options */
     $options = get_option('wpglobus_option');
     $options_post_types = empty($options['post_type']) ? array() : $options['post_type'];
     $disabled_post_types = array();
     /**
      * Add CPT from woocommerce
      */
     $disabled_post_types[] = 'product';
     $disabled_post_types[] = 'product_variation';
     $disabled_post_types[] = 'shop_order';
     $disabled_post_types[] = 'shop_order_refund';
     $disabled_post_types[] = 'shop_coupon';
     $disabled_post_types[] = 'shop_webhook';
     $enabled_post_types = array();
     foreach ($post_types as $post_type) {
         if (!in_array($post_type, $disabled_post_types, true)) {
             $enabled_post_types[] = $post_type;
         }
     }
     wp_enqueue_script('wpglobus-redux-field-post_types', plugins_url('/field_post_types' . WPGlobus::SCRIPT_SUFFIX() . '.js', __FILE__), array('jquery'), WPGlobus::SCRIPT_VER(), true);
     wp_localize_script('wpglobus-redux-field-post_types', 'wpglobus_post_types', array('post_type' => $enabled_post_types, 'options' => $options_post_types));
 }
function theme_register_meta_boxes()
{
    if (!class_exists('RW_Meta_Box')) {
        return;
    }
    $meta_boxes = array();
    $post_types = get_post_types();
    /**********************************************************************************/
    /* Intializes Each Above Meta Boxes */
    /**********************************************************************************/
    // $meta_boxes[] = array(
    //   'id' => 'custom_page_elements',
    //   'title' => 'Custom Page Elements',
    //   'pages' => array( 'page' ),
    //   'fields' => array(
    //     array(
    //       'name' => 'Logo',
    //       'id' => 'custom_logo',
    //       'type' => 'image_advanced',
    //       'desc' => 'Custom Logo'
    //       )
    //     )
    // );
    /**********************************************************************************/
    /* Registers Each Above Meta Boxes */
    /**********************************************************************************/
    foreach ($meta_boxes as $meta_box) {
        new RW_Meta_Box($meta_box);
    }
}
Beispiel #20
0
/**
 * Add Custom Post Types and Taxonomies to "At a Glance" Dashboard Widget
 *
 * Ref Link: http://wpsnipp.com/index.php/functions-php/include-custom-post-types-in-right-now-admin-dashboard-widget/
 * http://wordpress.org/support/topic/dashboard-at-a-glance-custom-post-types
 * http://halfelf.org/2012/my-custom-posttypes-live-in-mu/
 */
function seventeen_right_now_content_table_end()
{
    $args = array('public' => true, '_builtin' => false);
    $output = 'object';
    $operator = 'and';
    $post_types = get_post_types($args, $output, $operator);
    foreach ($post_types as $post_type) {
        $num_posts = wp_count_posts($post_type->name);
        $num = number_format_i18n($num_posts->publish);
        $text = _n($post_type->labels->name, $post_type->labels->name, intval($num_posts->publish));
        if (current_user_can('edit_posts')) {
            $cpt_name = $post_type->name;
        }
        echo '<li class="post-count ' . $post_type->name . '-count"><tr><a href="edit.php?post_type=' . $cpt_name . '"><td class="first b b-' . $post_type->name . '"></td>' . $num . '&nbsp;<td class="t ' . $post_type->name . '">' . $text . '</td></a></tr></li>';
    }
    $taxonomies = get_taxonomies($args, $output, $operator);
    foreach ($taxonomies as $taxonomy) {
        $num_terms = wp_count_terms($taxonomy->name);
        $num = number_format_i18n($num_terms);
        $text = _n($taxonomy->labels->name, $taxonomy->labels->name, intval($num_terms));
        if (current_user_can('manage_categories')) {
            $cpt_tax = $taxonomy->name;
        }
        echo '<li class="taxonomy-count ' . $taxonomy->name . '-count"><tr><a href="edit-tags.php?taxonomy=' . $cpt_tax . '"><td class="first b b-' . $taxonomy->name . '"></td>' . $num . '&nbsp;<td class="t ' . $taxonomy->name . '">' . $text . '</td></a></tr></li>';
    }
}
Beispiel #21
0
function async_share_post_types_options()
{
    $args = array('_builtin' => false);
    $cpt_types = get_post_types($args, 'names');
    array_push($cpt_types, 'page');
    return $cpt_types;
}
/**
 * the meta box for post/page purchase
 *
 */
function mgm_post_setup_meta_box()
{
    // 2.7+
    if (function_exists('add_meta_box')) {
        // update for custom post type
        if (function_exists('get_post_types')) {
            // get custom post types
            $custom_post_types = get_post_types(array(), 'objects');
            // add to array
            foreach ($custom_post_types as $post_type) {
                // set
                if ($post_type->show_ui) {
                    // check if enabled
                    $post_types[] = $post_type->name;
                }
            }
        } else {
            // default post types
            $post_types = array('post', 'page');
        }
        // assign
        foreach ($post_types as $post_type) {
            add_meta_box('magicmemberdiv', __('Magic Members'), 'mgm_post_setup_meta_box_form', $post_type, 'side', 'high');
        }
    } else {
        // just for test: deprecated
        add_action('dbx_post_advanced', 'mgm_post_setup_meta_box_form');
        add_action('dbx_page_advanced', 'mgm_post_setup_meta_box_form');
    }
}
Beispiel #23
0
 function get_post_types()
 {
     $array = get_post_types();
     foreach ($array as $k => $v) {
         $this->get_post_types[] = $k;
     }
 }
 protected function getTaxonomies()
 {
     if ($this->taxonomies === false) {
         $this->taxonomies = get_object_taxonomies(!empty($this->loop_args['post_type']) ? $this->loop_args['post_type'] : get_post_types(array('public' => false, 'name' => 'attachment'), 'names', 'NOT'));
     }
     return $this->taxonomies;
 }
Beispiel #25
0
 /**
  * Unregister existing post types and register defaults.
  *
  * Run before each test in order to clean up the global scope, in case
  * a test forgets to unregister a post type on its own, or fails before
  * it has a chance to do so.
  */
 protected function reset_post_types()
 {
     foreach (get_post_types() as $pt) {
         _unregister_post_type($pt);
     }
     create_initial_post_types();
 }
 function sd_remove_vc_boxes()
 {
     $post_types = get_post_types('', 'names');
     foreach ($post_types as $post_type) {
         remove_meta_box('vc_teaser', $post_type, 'side');
     }
 }
function wds_autolinks_settings()
{
    $name = 'wds_autolinks';
    $title = __('Automatic Links', 'wds');
    $description = __('<p>Sometimes you want to always link certain key words to a page on your blog or even a whole new site all together.</p>
	<p>For example, maybe anytime you write the words \'WordPress news\' you want to automatically create a link to the WordPress news blog, wpmu.org. Without this plugin, you would have to manually create these links each time you write the text in your pages and posts - which can be no fun at all.</p>
	<p>This section lets you set those key words and links. First, choose if you want to automatically link key words in posts, pages, or any custom post types you might be using. Usually when you are using automatic links, you will want to check all of the options here.</p>', 'wds');
    $fields = array();
    foreach (get_post_types() as $post_type) {
        if (!in_array($post_type, array('revision', 'nav_menu_item', 'attachment'))) {
            $pt = get_post_type_object($post_type);
            $key = strtolower($pt->name);
            $post_types["l{$key}"] = $pt->labels->name;
            $insert["{$key}"] = $pt->labels->name;
        }
    }
    foreach (get_taxonomies() as $taxonomy) {
        if (!in_array($taxonomy, array('nav_menu', 'link_category', 'post_format'))) {
            $tax = get_taxonomy($taxonomy);
            $key = strtolower($tax->labels->name);
            $taxonomies["l{$key}"] = $tax->labels->name;
        }
    }
    $linkto = array_merge($post_types, $taxonomies);
    $insert['comment'] = __('Comments', 'wds');
    $fields['internal'] = array('title' => '', 'intro' => '', 'options' => array(array('type' => 'checkbox', 'name' => 'insert', 'title' => __('Insert links in', 'wds'), 'items' => $insert), array('type' => 'checkbox', 'name' => 'linkto', 'title' => __('Link to', 'wds'), 'items' => $linkto), array('type' => 'dropdown', 'name' => 'cpt_char_limit', 'title' => __('Minimum post title length', 'wds'), 'description' => __('This is the minimum number of characters your post title has to have to be considered for insertion as auto-link.', 'wds'), 'items' => array_combine(array_merge(array(0), range(1, 25)), array_merge(array(__('Default', 'wds')), range(1, 25)))), array('type' => 'dropdown', 'name' => 'tax_char_limit', 'title' => __('Minimum taxonomy title length', 'wds'), 'description' => __('This is the minimum number of characters your taxonomy title has to have to be considered for insertion as auto-link.', 'wds'), 'items' => array_combine(array_merge(array(0), range(1, 25)), array_merge(array(__('Default', 'wds')), range(1, 25)))), array('type' => 'checkbox', 'name' => 'allow_empty_tax', 'title' => __('Empty taxonomies', 'wds'), 'items' => array('allow_empty_tax' => __('Allow autolinks to empty taxonomies', 'wds'))), array('type' => 'checkbox', 'name' => 'excludeheading', 'title' => __('Exclude Headings', 'wds'), 'items' => array('excludeheading' => __('Prevent linking in heading tags', 'wds'))), array('type' => 'text', 'name' => 'ignorepost', 'title' => __('Ignore posts and pages', 'wds'), 'description' => __('Paste in the IDs, slugs or titles for the post/pages you wish to exclude and separate them by commas', 'wds')), array('type' => 'text', 'name' => 'ignore', 'title' => __('Ignore keywords', 'wds'), 'description' => __('Paste in the keywords you wish to exclude and separate them by commas', 'wds')), array('type' => 'dropdown', 'name' => 'link_limit', 'title' => __('Maximum autolinks number limit', 'wds'), 'description' => __('This is the maximum number of autolinks that will be added to your posts.', 'wds'), 'items' => array_combine(array_merge(array(0), range(1, 20)), array_merge(array(__('Unlimited', 'wds')), range(1, 20)))), array('type' => 'dropdown', 'name' => 'single_link_limit', 'title' => __('Maximum single autolink occurrence', 'wds'), 'description' => __('This is a number of single link replacement occurrences.', 'wds'), 'items' => array_combine(array_merge(array(0), range(1, 10)), array_merge(array(__('Unlimited', 'wds')), range(1, 10)))), array('type' => 'textarea', 'name' => 'customkey', 'title' => __('Custom Keywords', 'wds'), 'description' => __('Paste in the extra keywords you want to automaticaly link. Use comma to seperate keywords and add target url at the end. Use a new line for new url and set of keywords.
				<br />Example:<br />
				<code>WPMU DEV, plugins, themes, http://premium.wpmudev.org/<br />
				WordPress News, http://wpmu.org/<br /></code>', 'wds')), array('type' => 'checkbox', 'name' => 'reduceload', 'title' => __('Other settings', 'wds'), 'items' => array('onlysingle' => __('Process only single posts and pages', 'wds'), 'allowfeed' => __('Process RSS feeds', 'wds'), 'casesens' => __('Case sensitive matching', 'wds'), 'customkey_preventduplicatelink' => __('Prevent duplicate links', 'wds'), 'target_blank' => __('Open links in new tab/window', 'wds'), 'rel_nofollow' => __('Autolinks <code>nofollow</code>', 'wds')))));
    $contextual_help = '';
    if (wds_is_wizard_step('5')) {
        $settings = new WDS_Core_Admin_Tab($name, $title, $description, $fields, 'wds', $contextual_help);
    }
}
Beispiel #28
0
 protected function getPostTypes($args = [])
 {
     $defaults = ['show_ui' => true];
     $args = wp_parse_args($args, $defaults);
     $post_types = get_post_types(apply_filters('g5_assignments_get_post_types_args', $args), 'object');
     return $post_types;
 }
 private static function get_menu_position()
 {
     $count = count(get_post_types(array('show_ui' => true, '_builtin' => false, 'show_in_menu' => true)));
     $pos = $count ? '22.7' : '29.3';
     $pos = apply_filters('frm_menu_position', $pos);
     return $pos;
 }
Beispiel #30
0
/**
 * Function to add meta box in Write screens of Post, Page and Custom Post Types.
 *
 * @since	1.9.1
 *
 * @param	text   $post_type
 * @param	object $post
 */
function crp_add_meta_box($post_type, $post)
{
    global $crp_settings;
    // If metaboxes are disabled, then exit
    if (!$crp_settings['show_metabox']) {
        return;
    }
    // If current user isn't an admin and we're restricting metaboxes to admins only, then exit
    if (!current_user_can('manage_options') && $crp_settings['show_metabox_admins']) {
        return;
    }
    $args = array('public' => true);
    $post_types = get_post_types($args);
    /**
     * Filter post types on which the meta box is displayed
     *
     * @since	2.2.0
     *
     * @param	array	$post_types	Array of post types
     */
    $post_types = apply_filters('crp_meta_box_post_types', $post_types);
    if (in_array($post_type, $post_types)) {
        add_meta_box('crp_metabox', 'Contextual Related Posts', 'crp_call_meta_box', $post_type, 'advanced', 'default');
    }
}