php 隐藏Elementor小部件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 隐藏Elementor小部件相关的知识,希望对你有一定的参考价值。

global $elementor_widget_blacklist;

$elementor_widget_blacklist = [
  ,'common'
  ,'heading'
  ,'image'
  ,'text-editor'
  ,'video'
  ,'button'
  ,'divider'
  ,'spacer'
  ,'image-box'
  ,'google-maps'
  ,'icon'
  ,'icon-box'
  ,'image-gallery'
  ,'image-carousel'
  ,'icon-list'
  ,'counter'
  ,'progress'
  ,'testimonial'
  ,'tabs'
  ,'accordion'
  ,'toggle'
  ,'social-icons'
  ,'alert'
  ,'audio'
  ,'shortcode'
  ,'html'
  ,'menu-anchor'
  ,'sidebar'

  // pro ----------------- //
  ,'posts'
  ,'portfolio'
  ,'slides'
  ,'form'
  ,'login'
  ,'media-carousel'
  ,'testimonial-carousel'
  ,'nav-menu'
  ,'pricing'
  ,'facebook-comment'
  ,'nav-menu'
  ,'animated-headline'
  ,'price-list'
  ,'price-table'
  ,'facebook-button'
  ,'facebook-comments'
  ,'facebook-embed'
  ,'facebook-page'
  ,'add-to-cart'
  ,'categories'
  ,'elements'
  ,'products'
  ,'flip-box'
  ,'carousel'
  ,'countdown'
  ,'share-buttons'
  ,'author-box'
  ,'breadcrumbs'
  ,'search-form'
  ,'post-navigation'
  ,'post-comments'
  ,'theme-elements'
  ,'blockquote'
  ,'template'
  ,'wp-widget-audio'
  ,'woocommerce'
  ,'social'
  ,'library'

  // wp widgets ----------------- //
  ,'wp-widget-pages'
  ,'wp-widget-archives'
  ,'wp-widget-media_audio'
  ,'wp-widget-media_image'
  ,'wp-widget-media_gallery'
  ,'wp-widget-media_video'
  ,'wp-widget-meta'
  ,'wp-widget-search'
  ,'wp-widget-text'
  ,'wp-widget-categories'
  ,'wp-widget-recent-posts'
  ,'wp-widget-recent-comments'
  ,'wp-widget-rss'
  ,'wp-widget-tag_cloud'
  ,'wp-widget-nav_menu'
  ,'wp-widget-custom_html'
  ,'wp-widget-polylang'
  ,'wp-widget-calendar'
  ,'wp-widget-elementor-library'
];

add_action('elementor/widgets/widgets_registered', function($widgets_manager){
  global $elementor_widget_blacklist;

  foreach($elementor_widget_blacklist as $widget_name){
    $widgets_manager->unregister_widget_type($widget_name);
  }
}, 15);

以上是关于php 隐藏Elementor小部件的主要内容,如果未能解决你的问题,请参考以下文章

php 将自定义控件添加到现有Elementor窗口小部件

php 按Anywhere Elementor小部件中的今天和未来日期排序

php 在管理仪表板页面上删除不必要的Elementor小部件

如何在 Elementor 中删除小部件和布局子项之间的间隙/空间?

将 GoDaddy 托管 Wordpress 与 Elementor 一起使用时,HTML 小部件无法正确呈现

WordPress Elementor Pro 仅制作导航菜单小部件项目下拉菜单