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


PHP WP_Customize_Manager::sections方法代码示例

本文整理汇总了PHP中WP_Customize_Manager::sections方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Customize_Manager::sections方法的具体用法?PHP WP_Customize_Manager::sections怎么用?PHP WP_Customize_Manager::sections使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WP_Customize_Manager的用法示例。


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

示例1: _unregister_core_ui

 /**
  * Removes all non-AMP sections and panels.
  *
  * Provides a clean, standalone instance-like experience by removing all non-AMP registered panels and sections.
  *
  * @since 0.4
  * @access private
  */
 private function _unregister_core_ui()
 {
     $panels = $this->wp_customize->panels();
     $sections = $this->wp_customize->sections();
     foreach ($panels as $panel_id => $object) {
         $this->wp_customize->remove_panel($panel_id);
     }
     foreach ($sections as $section_id => $object) {
         $this->wp_customize->remove_section($section_id);
     }
 }
开发者ID:thenextweb,项目名称:amp-wp,代码行数:19,代码来源:class-amp-customizer.php

示例2: createPanels

 /**
  * Create all panels and sections
  *
  * @param \WP_Customize_Manager $wp_customize the WP customizer
  * @return \WP_Customize_Manager
  */
 public function createPanels($wp_customize)
 {
     $data = $this->getData();
     // Move all default sections to the default panel
     $defaultPanel = $data['options']['default_panel'];
     $wp_customize->add_panel($defaultPanel['id'], array('priority' => 10, 'title' => Strings::translate($defaultPanel['title']), 'description' => ''));
     $existingSections = $wp_customize->sections();
     /** @var \WP_Customize_Section $section */
     foreach ($existingSections as $sectionId => $section) {
         if (empty($section->panel)) {
             $section->panel = $defaultPanel['id'];
         }
     }
     // Define additional panels and sections
     $panels = $data['panels'];
     $panelPriority = 1000;
     foreach ($panels as $panelProps) {
         if (isset($panelProps['title'])) {
             $panelId = 'panel-' . $panelPriority;
             $wp_customize->add_panel($panelId, array('priority' => $panelPriority, 'title' => Strings::translate($panelProps['title']), 'description' => Strings::translate($panelProps['description'])));
         } else {
             $panelId = $defaultPanel['id'];
         }
         $sectionPriority = 10;
         foreach ($panelProps['sections'] as $sectionId => $sectionProps) {
             $wp_customize->add_section($sectionId, array('panel' => $panelId, 'priority' => $sectionPriority, 'title' => Strings::translate($sectionProps['title']), 'description' => Strings::translate($sectionProps['description'])));
             $sectionPriority += 10;
         }
         $panelPriority += 10;
     }
     return $wp_customize;
 }
开发者ID:marvinlabs,项目名称:baobab,代码行数:38,代码来源:Customizer.php

示例3: array

 /**
  * @ticket 37128
  */
 function test_prepare_controls_wp_list_sort_sections()
 {
     wp_set_current_user(self::$admin_user_id);
     $sections = array('foo' => 2, 'bar' => 4, 'foobar' => 3, 'key' => 1);
     $sections_sorted = array('key', 'foo', 'foobar', 'bar');
     foreach ($sections as $section_id => $priority) {
         $this->manager->add_section($section_id, array('priority' => $priority));
     }
     $this->manager->prepare_controls();
     $result = $this->manager->sections();
     $this->assertEquals($sections_sorted, array_keys($result));
 }
开发者ID:CompositeUK,项目名称:clone.WordPress-Develop,代码行数:15,代码来源:manager.php


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