Beispiel #1
0
 public function getSortableMetaKeys()
 {
     if (!isset($_POST['posttype']) || empty($_POST['posttype'])) {
         echo '0';
         die;
     }
     $meta = \Modularity\Helper\Post::getPosttypeMetaKeys($_POST['posttype']);
     $response = array('meta_keys' => $meta, 'curr' => get_field('sorted_by', $_POST['post']));
     echo json_encode($response);
     die;
 }
 public function isModularitySidebarActive($sidebar)
 {
     $template = \Modularity\Helper\Post::getPostTemplate();
     if (!file_exists($template)) {
         $template = \Modularity\Helper\Wp::findCoreTemplates([$template, 'archive']);
     }
     $options = get_option('modularity-options');
     if (is_home()) {
         $template = 'home';
     }
     if (!isset($options['enabled-areas'][$template]) || !in_array($sidebar, $options['enabled-areas'][$template])) {
         return false;
     }
     return true;
 }
Beispiel #3
0
 /**
  * Saves post modules
  * @return boolean
  */
 public function savePost()
 {
     $key = $_REQUEST['id'];
     if (is_numeric($key)) {
         return $this->saveAsPostMeta($key);
     }
     if (\Modularity\Helper\Post::isArchive()) {
         global $archive;
         $key = $archive;
     }
     return $this->saveAsOption($key);
 }