| | |
| | | protected Cache $cache; |
| | | |
| | | public function __construct(string $title, string $slug = '', string $icon ='', int $parent = 0) { |
| | | $this->cache = Cache::for('dashboard'); |
| | | if (JVB_TESTING) { |
| | | $this->cache->flush(); |
| | | } |
| | | $this->cache = Cache::for('dash_pages'); |
| | | |
| | | $this->title = $title; |
| | | $this->setSlug(empty($slug) ? $title : $slug); |
| | | $this->icon = $icon; |
| | |
| | | $this->slug.'_ID', |
| | | function() use ($parentID) { |
| | | $existing = new WP_Query([ |
| | | 'post_type' => DashboardManager::$based, |
| | | 'post_type' => Dashboard::$based, |
| | | 'name' => $this->slug, |
| | | 'fields' => 'ids', |
| | | 'posts_per_page'=> 1, |
| | |
| | | $args = [ |
| | | 'post_title' => $this->title, |
| | | 'post_name' => $this->slug, |
| | | 'post_type' => DashboardManager::$based, |
| | | 'post_type' => Dashboard::$based, |
| | | 'post_status' => 'publish' |
| | | ]; |
| | | if ($parentID > 0) { |
| | |
| | | { |
| | | |
| | | if ($this->slug === 'dash') { |
| | | $this->URL = get_post_type_archive_link(DashboardManager::$based); |
| | | $this->URL = get_post_type_archive_link(Dashboard::$based); |
| | | return; |
| | | } |
| | | $this->URL = get_the_permalink($this->ID); |