当前位置: 首页>>代码示例>>PHP>>正文


PHP remove_post_type_support函数代码示例

本文整理汇总了PHP中remove_post_type_support函数的典型用法代码示例。如果您正苦于以下问题:PHP remove_post_type_support函数的具体用法?PHP remove_post_type_support怎么用?PHP remove_post_type_support使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了remove_post_type_support函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setup_post_types

/**
 * Register custom post types: Place, Event
 */
function setup_post_types()
{
    register_post_type('place', array('label' => 'Place', 'description' => 'Represents physical address or Internet resource', 'labels' => array('name' => 'Places', 'singular_name' => 'Place', 'menu_name' => 'Places', 'name_admin_bar' => 'Place', 'all_items' => 'All Places', 'add_new_item' => 'Add New Place', 'new_item' => 'New Place', 'edit_item' => 'Edit Place', 'update_item' => 'Update Place', 'view_item' => 'View Place', 'search_items' => 'Search Places'), 'taxonomies' => array('post_tag'), 'supports' => array('title', 'editor', 'author', 'thumbnail', 'revisions'), 'public' => true, 'menu_position' => 5, 'menu_icon' => 'dashicons-location-alt'));
    register_post_type('event', array('label' => 'Event', 'description' => 'Represents public event', 'labels' => array('name' => 'Events', 'singular_name' => 'Event', 'menu_name' => 'Events', 'name_admin_bar' => 'Event', 'all_items' => 'All Events', 'add_new_item' => 'Add New Event', 'new_item' => 'New Event', 'edit_item' => 'Edit Event', 'update_item' => 'Update Event', 'view_item' => 'View Event', 'search_items' => 'Search Events'), 'taxonomies' => array('post_tag'), 'supports' => array('title', 'editor', 'author', 'thumbnail', 'revisions'), 'public' => true, 'menu_position' => 5, 'menu_icon' => 'dashicons-calendar-alt'));
    /**
     * Setup Hromada post types filter
     */
    add_filter('hromada_post_types', function (array $post_types) {
        $post_types[] = 'post';
        $post_types[] = 'place';
        $post_types[] = 'event';
        $post_types[] = 'page';
        return $post_types;
    });
    /**
     * Customize post and page features
     */
    $remove_features = array('excerpt', 'trackbacks', 'custom-fields', 'comments', 'page-attributes', 'post-formats');
    foreach ($remove_features as $feature) {
        remove_post_type_support('post', $feature);
    }
    unregister_taxonomy_for_object_type('category', 'post');
    $remove_features = array('author', 'page-attributes', 'custom-fields', 'comments');
    foreach ($remove_features as $feature) {
        remove_post_type_support('page', $feature);
    }
}
开发者ID:roman-kulish,项目名称:hromada-wordpress-authoring,代码行数:30,代码来源:authoring.php

示例2: so_remove_editor

function so_remove_editor()
{
    // If not in the admin, return.
    if (!is_admin()) {
        return;
    }
    // Get the post ID on edit post with filter_input super global inspection.
    $current_post_id = filter_input(INPUT_GET, 'post', FILTER_SANITIZE_NUMBER_INT);
    // Get the post ID on update post with filter_input super global inspection.
    $update_post_id = filter_input(INPUT_POST, 'post_ID', FILTER_SANITIZE_NUMBER_INT);
    // Check to see if the post ID is set, else return.
    if (isset($current_post_id)) {
        $post_id = absint($current_post_id);
    } else {
        if (isset($update_post_id)) {
            $post_id = absint($update_post_id);
        } else {
            return;
        }
    }
    // Don't do anything unless there is a post_id.
    if (isset($post_id)) {
        // Get the template of the current post.
        $template_file = get_post_meta($post_id, '_wp_page_template', true);
        // Example of removing page editor for page-your-template.php template.
        if ('page-your-template.php' === $template_file) {
            remove_post_type_support('page', 'editor');
            // Other features can also be removed in addition to the editor. See: https://codex.wordpress.org/Function_Reference/remove_post_type_support.
            remove_post_type_support('page', 'thumbnail');
        }
    }
}
开发者ID:SpiritPixels,项目名称:Code-Snippets,代码行数:32,代码来源:remove-editor-from-page-template.php

示例3: setup_filters

 function setup_filters()
 {
     $types = array_keys(get_post_types(array('public' => true), 'objects'));
     if (!empty($types)) {
         foreach ($types as $type) {
             // we need to know what native support was for later
             if (post_type_supports($type, 'comments')) {
                 remove_post_type_support($type, 'comments');
                 remove_post_type_support($type, 'trackbacks');
             }
         }
     }
     // Filters for the admin only
     if (is_admin()) {
         add_action('admin_menu', array($this, 'filter_admin_menu'), 9999);
         // do this as late as possible
         add_action('admin_head', array($this, 'hide_dashboard_bits'));
         add_action('wp_dashboard_setup', array($this, 'filter_dashboard'));
         add_filter('pre_option_default_pingback_flag', '__return_zero');
     } else {
         add_action('template_redirect', array($this, 'check_comment_template'));
         add_filter('comments_open', array($this, 'filter_comment_status'), 20, 2);
         add_filter('pings_open', array($this, 'filter_comment_status'), 20, 2);
         // remove comments links from feed
         add_filter('post_comments_feed_link', '__return_false', 10, 1);
         add_filter('comments_link_feed', '__return_false', 10, 1);
         add_filter('comment_link', '__return_false', 10, 1);
         // remove comment count from feed
         add_filter('get_comments_number', '__return_false', 10, 2);
         // Remove feed link from header
         add_filter('feed_links_show_comments_feed', '__return_false');
         // run when wp_head executes
         add_action('wp_head', array($this, 'before_wp_head'), 0);
     }
 }
开发者ID:tylergets,项目名称:disable-comments-for-disqus-mu,代码行数:35,代码来源:disable-comments-for-disqus-mu.php

示例4: scoutwp_init

/**
 * Theme init hook.
 * Removes emoticons, comments, post tags and default jquery.
 * Registers javascript and css files and adds post format support, html 5 support and thumbnails.
 * @return null
 */
function scoutwp_init()
{
    // disable emojis
    remove_action('wp_head', 'print_emoji_detection_script', 7);
    remove_action('admin_print_scripts', 'print_emoji_detection_script');
    remove_action('wp_print_styles', 'print_emoji_styles');
    remove_action('admin_print_styles', 'print_emoji_styles');
    remove_filter('the_content_feed', 'wp_staticize_emoji');
    remove_filter('comment_text_rss', 'wp_staticize_emoji');
    remove_filter('wp_mail', 'wp_staticize_emoji_for_email');
    add_filter('tiny_mce_plugins', 'disable_emojis_tinymce');
    // remove comments
    remove_post_type_support('post', 'comments');
    remove_post_type_support('page', 'comments');
    // remove Tags
    unregister_taxonomy_for_object_type('post_tag', 'post');
    // deregister jquery
    wp_deregister_script('jquery');
    // register js scripts
    // Must be before any other jquery
    wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js', array(), null, true);
    wp_register_script('scoutwp-theme', get_stylesheet_directory_uri() . '/js/script.min.js', array(), null, true);
    wp_register_script('unslider', get_stylesheet_directory_uri() . '/js/unslider.min.js', array(), null, true);
    // register css
    wp_register_style('scoutwp-theme', get_template_directory_uri() . '/css/style.min.css', array(), null);
    wp_register_style('scoutwp-icons', get_template_directory_uri() . '/icons/css/sp-icon-font.css', array(), null);
    wp_register_style('scoutwp-fonts', 'http://fonts.googleapis.com/css?family=Bitter:700|Open+Sans:400,400italic,600', array(), null);
    // add post format support
    add_theme_support('post-formats', array('aside', 'image', 'video', 'quote', 'link', 'gallery'));
    // add html 5 support
    add_theme_support('html5', array('gallery'));
    // add thumbnail support
    add_theme_support('post-thumbnails');
}
开发者ID:ajgamble-milner,项目名称:scoutwp_theme,代码行数:40,代码来源:functions.php

示例5: base_remove_pages_support

function base_remove_pages_support()
{
    $base_features = array();
    foreach ($base_features as $base_feature) {
        remove_post_type_support('page', $base_feature);
    }
}
开发者ID:powleeno,项目名称:wordpressBase,代码行数:7,代码来源:custom-meta-boxes.php

示例6: barcelona_remove_ev_post_type_support

function barcelona_remove_ev_post_type_support()
{
    $barcelona_pt = array('page', 'attachment', 'literature', 'portfolio_item', 'recipe', 'restaurant_item');
    foreach ($barcelona_pt as $k) {
        remove_post_type_support($k, 'entry-views');
    }
}
开发者ID:yalmaa,项目名称:little-magazine,代码行数:7,代码来源:theme-support.php

示例7: flipster_init

function flipster_init()
{
    // Remove page post type comment support
    remove_post_type_support('page', 'comments');
    // Register additional menus, we already have a Primary menu registered
    register_nav_menu('footer-menu', __('Footer Menu', 'flipster'));
}
开发者ID:kkthemes,项目名称:flipster-wordpress-theme,代码行数:7,代码来源:functions.php

示例8: import_blog

        function import_blog($connector)
        {
            //AGC: Moved the parameter parsing out to start and the importing into separate functions.
            //25/1/2013 Suppress post revisions whilst we are importing
            remove_post_type_support('post', 'revisions');
            
            $this->importer_started = time();
            
            if (!$this->import_posts($connector))
                return ('continue');
            if (!$this->import_comments($connector))
                return ('continue');

            if (Blogger_Import::IMPORT_IMG)
            {
                if (!$this->process_images())
                    return('continue');
            }

            if (!$this->process_links()) 
                return('continue');

            $this->mode = 'authors';
            $this->save_vars();

            if (!$this->posts_done && !$this->comments_done)
                return('nothing');

            //Thought: Should this be passing an ID so we know which blog just got imported.
            do_action('import_done', 'blogger');
            
            return('done');
        }
开发者ID:niamherinoc,项目名称:rctractors,代码行数:33,代码来源:blogger-importer-blog.php

示例9: test_set_get_post_format_for_page

 /**
  * @ticket 22473
  */
 function test_set_get_post_format_for_page()
 {
     $post_id = $this->factory->post->create(array('post_type' => 'page'));
     $format = get_post_format($post_id);
     $this->assertFalse($format);
     $result = set_post_format($post_id, 'aside');
     $this->assertNotInstanceOf('WP_Error', $result);
     $this->assertInternalType('array', $result);
     $this->assertEquals(1, count($result));
     // The format can be set but not retrieved until it is registered.
     $format = get_post_format($post_id);
     $this->assertFalse($format);
     // Register format support for the page post type.
     add_post_type_support('page', 'post-formats');
     // The previous set can now be retrieved.
     $format = get_post_format($post_id);
     $this->assertEquals('aside', $format);
     $result = set_post_format($post_id, 'standard');
     $this->assertNotInstanceOf('WP_Error', $result);
     $this->assertInternalType('array', $result);
     $this->assertEquals(0, count($result));
     $result = set_post_format($post_id, '');
     $this->assertNotInstanceOf('WP_Error', $result);
     $this->assertInternalType('array', $result);
     $this->assertEquals(0, count($result));
     remove_post_type_support('page', 'post-formats');
 }
开发者ID:boonebgorges,项目名称:wp,代码行数:30,代码来源:formats.php

示例10: register_cpt_mp_faq

function register_cpt_mp_faq()
{
    $labels = array('name' => _x('FAQs', 'mp_faq'), 'singular_name' => _x('Question', 'mp_faq'), 'add_new' => _x('Add New', 'mp_faq'), 'add_new_item' => _x('Add New Question', 'mp_faq'), 'edit_item' => _x('Edit Question', 'mp_faq'), 'new_item' => _x('New Question', 'mp_faq'), 'view_item' => _x('View Question', 'mp_faq'), 'search_items' => _x('Search FAQs', 'mp_faq'), 'not_found' => _x('No faqs found', 'mp_faq'), 'not_found_in_trash' => _x('No faqs found in Trash', 'mp_faq'), 'parent_item_colon' => _x('Parent Question:', 'mp_faq'), 'menu_name' => _x('FAQs', 'mp_faq'));
    $args = array('labels' => $labels, 'hierarchical' => true, 'description' => 'MotoPro FAQs CPT.', 'supports' => array('title'), 'public' => false, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 5, 'menu_icon' => 'dashicons-editor-help', 'show_in_nav_menus' => false, 'publicly_queryable' => true, 'exclude_from_search' => true, 'has_archive' => false, 'query_var' => true, 'can_export' => true, 'rewrite' => false, 'capability_type' => 'page');
    register_post_type('mp_faq', $args);
    remove_post_type_support('mp_faq', 'title');
}
开发者ID:kevwaddell,项目名称:motopro-desktop,代码行数:7,代码来源:faq-cpt.php

示例11: modify_object_type

 /**
  * Modify "Post" Object Type
  *
  * Rename labels, disable comments, and enable archive.
  */
 public function modify_object_type()
 {
     _x('news', 'URI slug', 'boilerplate');
     $this->obj_page = 'page' === get_option('show_on_front') ? get_option('page_for_posts') : false;
     $this->set_rewrite_slug('news');
     unregister_taxonomy_for_object_type('post_tag', 'post');
     remove_post_type_support($this->obj_type, 'comments');
     remove_post_type_support($this->obj_type, 'custom-fields');
     $object = get_post_type_object($this->obj_type);
     $labels =& $object->labels;
     $labels->name = __('News', 'boilerplate');
     $labels->menu_name = __('News', 'boilerplate');
     $labels->name_admin_bar = __('News', 'boilerplate');
     $labels->singular_name = __('Article', 'boilerplate');
     $labels->search_items = __('Search Articles', 'boilerplate');
     $labels->all_items = __('All Articles', 'boilerplate');
     if ($this->obj_page) {
         $object->has_archive = true;
     }
     /*
             if ( $this->rewrite_slug ) {
                 $object->rewrite['slug'] = $this->rewrite_slug;
             }
     */
     register_post_type($this->obj_type, $object);
 }
开发者ID:locomotivemtl,项目名称:wordpress-boilerplate,代码行数:31,代码来源:post.php

示例12: simple_inventory_post_type

function simple_inventory_post_type()
{
    $labels = array('name' => __('Goods / Products', 'simple-inventory'), 'singular_name' => __('Good / Product', 'simple-inventory'), 'add_new' => __('Add New', 'simple-inventory'), 'add_new_item' => __('Add New Good / Product', 'simple-inventory'), 'edit_item' => __('Edit Good / Product', 'simple-inventory'), 'new_item' => __('New Good / Product', 'simple-inventory'), 'all_items' => __('All Goods / Products', 'simple-inventory'), 'view_item' => __('View Good / Product', 'simple-inventory'), 'search_items' => __('Search Goods / Products', 'simple-inventory'), 'not_found' => __('No Goods / Products found', 'simple-inventory'), 'not_found_in_trash' => __('No Goods / Products found in Trash', 'simple-inventory'), 'parent_item_colon' => '', 'menu_name' => __('Goods / Products'));
    $args = array('labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'query_var' => true, 'rewrite' => array('slug' => __('inventory', 'simple-inventory')), 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => true, 'menu_icon' => 'dashicons-cart', 'menu_position' => null, 'taxonomies' => array('category'), 'supports' => array('title', 'revisions', 'excerpt', 'thumbnail'));
    register_post_type('si_good', $args);
    remove_post_type_support('si_good', 'editor');
}
开发者ID:biomassives,项目名称:simple-inventory,代码行数:7,代码来源:simple-inventory.php

示例13: starter_cpt_init

function starter_cpt_init()
{
    /* add new post type
    	register_post_type('news', array(
    		'labels' => array(
    			'name' 				=> 'Articles',
    			'menu_name'			=> 'News',
    			'sungular_name'		=> 'News Post',
    			'add_new_item'     	=> 'Add News Post',
    			'edit_item'			=> 'Edit News Post',
    			'view_item'			=> 'View News Post'
    		),
    		'supports'      		=> array('title', 'editor', 'thumbnail', 'excerpt'),
    		'public'				=> true,
    		'has_archive' 			=> true,
    		'rewrite' 				=> array('slug' => 'news'),
    		//'menu_position'		=> 21,
    		'publicly_queryable'	=> true,
    	));
    	*/
    // remove unused functionality from pages
    remove_post_type_support('page', 'comments');
    unregister_taxonomy_for_object_type('post_tag', 'post');
    // remove unused functionality from posts
    // remove_post_type_support('post', 'tags');
    // add excerpts to pages (e.g. page summaries to be used on page lists)
    add_post_type_support('page', 'excerpt');
}
开发者ID:GaryJones,项目名称:Starter-WP,代码行数:28,代码来源:post-types.php

示例14: setup_custom_post_type

 public static function setup_custom_post_type()
 {
     register_post_type('jh-data-table', array('labels' => array('name' => __('JH Data Tables'), 'singular_name' => __('JH Data Table'), 'all_items' => __('Manage Tables')), 'public' => true, 'has_archive' => true, 'menu_icon' => 'dashicons-analytics', 'rewrite' => array('slug' => 'data-tables')));
     remove_post_type_support('jh-data-table', 'editor');
     //global $wp_rewrite;
     //$wp_rewrite->flush_rules( true );  ought to be called at plug-in activation,
     // after registration of custom post types, etc. as this is an expensive call
 }
开发者ID:jhawcroft,项目名称:wordpress-tables-charts,代码行数:8,代码来源:data-tables.class.php

示例15: remove_markdown_support

 /**
  * Remove Jetpack Markdwon Support
  *
  * @since  1.0.0
  * @access public
  * @return void
  */
 public function remove_markdown_support()
 {
     if (class_exists('WPCom_Markdown')) {
         remove_post_type_support('post', WPCom_Markdown::POST_TYPE_SUPPORT);
         remove_post_type_support('page', WPCom_Markdown::POST_TYPE_SUPPORT);
         remove_post_type_support('revision', WPCom_Markdown::POST_TYPE_SUPPORT);
     }
 }
开发者ID:joasssko,项目名称:css-tricks-functionality-plugin,代码行数:15,代码来源:class-ctf-remove-markdown-support.php


注:本文中的remove_post_type_support函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。