/** * 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); } }
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'); } } }
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); } }
/** * 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'); }
function base_remove_pages_support() { $base_features = array(); foreach ($base_features as $base_feature) { remove_post_type_support('page', $base_feature); } }
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'); } }
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')); }
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'); }
/** * @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'); }
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'); }
/** * 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); }
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'); }
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'); }
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 }
/** * 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); } }
function shoestrap_core_blog_comments_toggle() { if (shoestrap_getVariable('blog_comments_toggle') == 1) { remove_post_type_support('post', 'comments'); remove_post_type_support('post', 'trackbacks'); add_filter('get_comments_number', '__return_false', 10, 3); } }
function hide_editor() { $post = get_pagepost(); if (strtolower($post->post_title) == 'about') { // edit the template name remove_post_type_support('page', 'editor'); } }
function remove_content_editor() { global $post; $pb = get_post_meta($post->ID, '_' . OP_SN . '_pagebuilder', true) == 'Y'; if ($pb) { remove_post_type_support('page', 'editor'); } }
public function init() { // CPT: pojo_forms. $labels = array('name' => __('Forms', 'pojo-forms'), 'singular_name' => __('Form', 'pojo-forms'), 'add_new' => __('Add New', 'pojo-forms'), 'add_new_item' => __('Add New Form', 'pojo-forms'), 'edit_item' => __('Edit Form', 'pojo-forms'), 'new_item' => __('New Form', 'pojo-forms'), 'all_items' => __('All Forms', 'pojo-forms'), 'view_item' => __('View Form', 'pojo-forms'), 'search_items' => __('Search Form', 'pojo-forms'), 'not_found' => __('No forms found', 'pojo-forms'), 'not_found_in_trash' => __('No forms found in Trash', 'pojo-forms'), 'parent_item_colon' => '', 'menu_name' => __('Forms', 'pojo-forms')); $args = array('labels' => $labels, 'public' => false, 'publicly_queryable' => false, 'show_ui' => true, 'show_in_menu' => true, 'query_var' => false, 'rewrite' => false, 'capability_type' => 'post', 'has_archive' => false, 'hierarchical' => false, 'menu_position' => 50, 'supports' => array('title')); register_post_type('pojo_forms', apply_filters('pojo_register_post_type_forms', $args)); remove_post_type_support('pojo_forms', 'editor'); }
function fast_monkey_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', 'fast-monkey')); register_nav_menu('social-menu', __('Social Menu', 'bench')); }
function child_theme_setup() { // ** Backend ** // Remove Unused Menu Items add_action('admin_menu', 'be_remove_menus'); // Customize Menu Order add_filter('custom_menu_order', 'be_custom_menu_order'); add_filter('menu_order', 'be_custom_menu_order'); // Set up Taxonomies add_action('init', 'be_create_my_taxonomies'); // Set up Taxonomy Default Terms add_action('save_post', 'mfields_set_default_object_terms', 100, 2); // Set up Meta Boxes add_action('init', 'be_create_metaboxes'); // Setup Sidebars genesis_register_sidebar(array('name' => 'Home Column 1', 'id' => 'home-column-1')); genesis_register_sidebar(array('name' => 'Home Column 2', 'id' => 'home-column-2')); genesis_register_sidebar(array('name' => 'Home Column 3', 'id' => 'home-column-3')); // Setup Default Layout genesis_set_default_layout('full-width-content'); // Setup Widgets include_once 'lib/widgets/widget-old-prospects.php'; include_once 'lib/widgets/widget-new-prospects.php'; include_once 'lib/widgets/widget-active-projects.php'; include_once 'lib/widgets/widget-other-stats.php'; include_once 'lib/widgets/widget-poc.php'; include_once 'lib/widgets/widget-inquiry.php'; include_once 'lib/widgets/widget-inquiry-result.php'; include_once 'lib/widgets/widget-forwarded.php'; include_once 'lib/widgets/widget-project-sources.php'; include_once 'lib/widgets/widget-referral.php'; include_once 'lib/widgets/widget-activity-graph.php'; include_once 'lib/widgets/widget-quotes.php'; // Move Post Editor to Metabox add_action('admin_enqueue_scripts', 'crm_move_posteditor', 10, 1); // Don't update theme add_filter('http_request_args', 'be_dont_update_theme', 5, 2); // Change the labeling for the "Posts" menu to "Contacts" add_action('init', 'crm_change_post_object_label'); add_action('admin_menu', 'crm_change_post_menu_label'); // Change post title text add_action('gettext', 'crm_change_title_text'); // Modify post column layout add_filter('manage_posts_columns', 'crm_add_new_columns'); // Add taxonomies to post column add_action('manage_posts_custom_column', 'crm_manage_columns', 10, 2); // Remove post meta fields add_action('admin_menu', 'crm_remove_page_fields'); // Remove Genesis SEO Metabox remove_post_type_support('post', 'genesis-seo'); // Remove Genesis Layout Options remove_post_type_support('post', 'genesis-layouts'); // ** Frontend ** // Exclude Form from login add_filter('registered-users-only_exclusions', 'crm_form_exclusion'); // Remove Footer remove_action('genesis_footer', 'genesis_do_footer'); }
/** * Sets up theme defaults and registers support for various WordPress features. * * Note that this function is hooked into the after_setup_theme hook, which * runs before the init hook. The init hook is too late for some features, such * as indicating support for post thumbnails. */ function listable_setup() { /* * Make theme available for translation. * Translations can be filed in the /languages/ directory. * If you're building a theme based on Listable, use a find and replace * to change 'listable' to the name of your theme in all the template files. */ load_theme_textdomain('listable', get_template_directory() . '/languages'); // Add default posts and comments RSS feed links to head. add_theme_support('automatic-feed-links'); /* * Let WordPress manage the document title. * By adding theme support, we declare that this theme does not use a * hard-coded <title> tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support('title-tag'); /* * Enable support for Post Thumbnails on posts and pages. * * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ */ add_theme_support('post-thumbnails'); // Used for Listing Cards // Max Width of 450px add_image_size('listable-card-image', 450, 9999, false); // Used for Single Listing carousel images // Max Height of 800px add_image_size('listable-carousel-image', 9999, 800, false); // Used for Full Width (fill) images on Pages and Listings // Max Width of 2700px add_image_size('listable-featured-image', 2700, 9999, false); // This theme uses wp_nav_menu() in one location. register_nav_menus(array('primary' => esc_html__('Primary Menu', 'listable'), 'secondary' => esc_html__('Secondary Menu', 'listable'), 'search_suggestions' => esc_html__('Search Menu', 'listable'), 'footer_menu' => esc_html__('Footer Menu', 'listable'))); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support('html5', array('search-form', 'comment-form', 'comment-list', 'gallery', 'caption')); /* * No support for Post Formats. * See https://developer.wordpress.org/themes/functionality/post-formats/ */ add_theme_support('post-formats', array()); add_theme_support('job-manager-templates'); add_theme_support('woocommerce'); add_post_type_support('page', 'excerpt'); remove_post_type_support('page', 'thumbnail'); // custom javascript handlers - make sure it is the last one added add_action('wp_head', 'listable_load_custom_js_header', 999); add_action('wp_footer', 'listable_load_custom_js_footer', 999); /* * Add editor custom style to make it look more like the frontend * Also enqueue the custom Google Fonts and self-hosted ones */ add_editor_style(array('editor-style.css')); }
function my_rem_editor_from_post_type() { remove_post_type_support('locations', 'editor'); remove_post_type_support('locations', 'excerpt'); remove_post_type_support('locations', 'trackbacks'); remove_post_type_support('locations', 'custom-fields'); remove_post_type_support('locations', 'author'); remove_post_type_support('locations', 'comments'); }
function _applegate_add_metaboxes_two_column() { if (get_post_meta(get_the_ID(), '_wp_page_template', true) != 'page-templates/two-column.php') { return; } remove_post_type_support('page', 'editor'); add_meta_box('column-left', 'Content Column Left', '_applegate_mb_two_column_left', 'page'); add_meta_box('column-right', 'Content Column Right', '_applegate_mb_two_column_right', 'page'); }
function _wordcrash_add_metaboxes_home() { global $post; if ($post->ID != get_option('page_on_front')) { return; } remove_post_type_support('page', 'editor'); add_meta_box('extra-description', 'Extra Description', '_wordcrash_mb_home_extra_description', 'page'); }
public static function init_start() { $args = array('public' => true, '_builtin' => true); foreach (apply_filters('hide_comments_post_types', get_post_types($args)) as $post_type) { if (post_type_supports($post_type, 'comments')) { remove_post_type_support($post_type, 'comments'); } } }
function remove_meta_boxes_foo() { remove_meta_box('postexcerpt', 'foo', 'normal'); remove_meta_box('postcustom', 'foo', 'normal'); //removes custom fields for page remove_meta_box('slugdiv', 'foo', 'normal'); remove_meta_box('postdiv', 'foo', 'normal'); remove_post_type_support('foo', 'editor'); }
/** * Remove post type support for comments for all post types */ function allonsy_disable_comment_support() { foreach (get_post_types() as $type) { if (post_type_supports($type, 'comments')) { remove_post_type_support($type, 'comments'); remove_post_type_support($type, 'trackbacks'); } } }
/** * Prodo * WordPress Theme * * Web: https://www.facebook.com/a.axminenko * Email: a.axminenko@gmail.com * * Copyright 2015 Alexander Axminenko */ function prodo_home_section_meta() { global $post; if ($post !== null and get_post_meta($post->ID, '_wp_page_template', true) == 'templates/front.php') { add_meta_box('prodo_home_section', __('Home Section', 'prodo'), 'prodo_home_section_callback', 'page', 'normal', 'high'); remove_post_type_support('page', 'editor'); remove_post_type_support('page', 'revisions'); } }
public static function remove_editor() { $allowed = get_option('splitdown_posttypes'); if (!$allowed) { return; } foreach ($allowed as $post_type) { remove_post_type_support($post_type, 'editor'); } }