コード例 #1
0
 /**
  * Get the widget's data.
  *
  * @return mixed
  */
 public function get_data()
 {
     $data = parent::get_data();
     $data['logo'] = Acf::get_option_field('contact_details_logo');
     $data['address'] = Acf::get_option_field('contact_details_address');
     $data['phone'] = Acf::get_option_field('contact_details_phone');
     $data['email'] = Acf::get_option_field('contact_details_email');
     return $data;
 }
コード例 #2
0
 /**
  * Get the widget's data.
  *
  * @return mixed
  */
 public function get_data()
 {
     $data = parent::get_data();
     $data['items'] = Acf::get_option_field('social_links');
     return $data;
 }
コード例 #3
0
ファイル: LeanMenu.php プロジェクト: moxie-lean/wp-widgets
 /**
  * Get the widget's data.
  *
  * @return mixed
  */
 public function get_data()
 {
     $data = parent::get_data();
     $settings = $this->get_settings()[$this->number];
     if (!isset($settings['menu'])) {
         return $data;
     }
     $menu_items = wp_get_nav_menu_items($settings['menu']);
     foreach ($menu_items as $menu_item) {
         if (!$menu_item->menu_item_parent) {
             $data['items'][] = ['title' => $menu_item->title, 'link' => str_replace(site_url(), '', $menu_item->url), 'items' => self::get_sub_menu_items($menu_items, $menu_item->ID)];
         }
     }
     return $data;
 }
コード例 #4
0
 /**
  * LeanDownloads constructor.
  */
 public function __construct()
 {
     parent::__construct('Lean Downloads', 'Display a list of downloads');
 }
コード例 #5
0
ファイル: LeanPreview.php プロジェクト: moxie-lean/wp-widgets
 /**
  * LeanPreview constructor.
  */
 public function __construct()
 {
     parent::__construct('Lean Preview', 'Display previews (header/description/link)');
 }
コード例 #6
0
ファイル: LeanRecent.php プロジェクト: moxie-lean/wp-widgets
 /**
  * Get the widget's data.
  *
  * @return mixed
  */
 public function get_data()
 {
     global $post;
     $settings = $this->get_settings()[$this->number];
     $args = ['post_type' => $settings['post_type'], 'posts_per_page' => $settings['number']];
     $recent = new \WP_Query($args);
     $data = parent::get_data();
     $data['items'] = [];
     while ($recent->have_posts()) {
         $recent->the_post();
         $post->link = get_permalink();
         $data['items'][] = $post;
     }
     wp_reset_postdata();
     return $data;
 }