Example #1
0
 /**
  * custom post type for wysija is call wysijap as in wysija's post
  */
 public static function create_post_type()
 {
     //by default there is url rewriteing on wysijap custom post, though in one client case I had to deactivate it.
     //as this is rare we just need to set this setting to activate it
     //by default let's deactivate the url rewriting of the wysijap confirmation page because it is breaking in some case.
     $show_interface = false;
     if (defined('WYSIJA_DBG') && WYSIJA_DBG > 1) {
         $show_interface = true;
     }
     register_post_type('wysijap', array('labels' => array('name' => __('Wysija page'), 'singular_name' => __('Wysija page')), 'public' => true, 'has_archive' => false, 'show_ui' => $show_interface, 'show_in_menu' => $show_interface, 'rewrite' => false, 'show_in_nav_menus' => false, 'can_export' => false, 'publicly_queryable' => true, 'exclude_from_search' => true));
     if (!get_option('wysija_post_type_updated')) {
         $modelPosts = new WYSIJA_model();
         $modelPosts->tableWP = true;
         $modelPosts->table_prefix = '';
         $modelPosts->table_name = 'posts';
         $modelPosts->noCheck = true;
         $modelPosts->pk = 'ID';
         if ($modelPosts->exists(array('post_type' => 'wysijapage'))) {
             $modelPosts->update(array('post_type' => 'wysijap'), array('post_type' => 'wysijapage'));
             flush_rewrite_rules(false);
         }
         WYSIJA::update_option('wysija_post_type_updated', time());
     }
     if (!get_option('wysija_post_type_created')) {
         flush_rewrite_rules(false);
         WYSIJA::update_option('wysija_post_type_created', time());
     }
 }
Example #2
0
 function create_post_type()
 {
     //$modelC=&WYSIJA::get('config','model');
     //$rewritewysijap=array("slug"=>"wysijap");
     //by default there is url rewriteing on wysijap custom post, though in one client case I had to deactivate it.
     //as this is rare we just need to set this setting to activate it
     //if($modelC->getValue('no_rewrite_wysijap'))$rewritewysijap=false;
     //by default let's deactivate the url rewriting of the wysijap confirmation page because it is breaking in some case.
     $rewritewysijap = false;
     register_post_type('wysijap', array('labels' => array('name' => __('Wysija page'), 'singular_name' => __('Wysija page')), 'public' => true, 'has_archive' => false, 'show_ui' => false, 'show_in_menu' => false, 'rewrite' => $rewritewysijap, 'show_in_nav_menus' => false, 'can_export' => false, 'publicly_queryable' => true, 'exclude_from_search' => true));
     if (!get_option('wysija_post_type_updated')) {
         $modelPosts = new WYSIJA_model();
         $modelPosts->tableWP = true;
         $modelPosts->table_prefix = '';
         $modelPosts->table_name = 'posts';
         $modelPosts->noCheck = true;
         $modelPosts->pk = 'ID';
         if ($modelPosts->exists(array('post_type' => 'wysijapage'))) {
             $modelPosts->update(array('post_type' => 'wysijap'), array('post_type' => 'wysijapage'));
             flush_rewrite_rules(false);
         }
         WYSIJA::update_option('wysija_post_type_updated', time());
     }
     if (!get_option('wysija_post_type_created')) {
         flush_rewrite_rules(false);
         WYSIJA::update_option('wysija_post_type_created', time());
     }
     /*
             $rewritewysija=array('slug'=>'wysija');
             register_post_type( 'wysija',
                 array(
                         'labels' => array(
                                 'name' => 'Wysija Archives',
                                 'singular_name' => 'Wysija archives'
                         ),
                 'public' => true,
                 'has_archive' => false,
                 'show_ui' =>false,
                 'show_in_menu' =>false,
                 'rewrite' => $rewritewysija,
                 'show_in_nav_menus'=>false,
                 'can_export'=>false,
                 'publicly_queryable'=>true,
                 'exclude_from_search'=>true,
                 )
             );
     
             if(!get_option('wysija_post_type2_created')) {
                 flush_rewrite_rules( false );
                 WYSIJA::update_option('wysija_post_type2_created',time());
             }*/
 }