Tagged: 

Viewing 16 reply threads
  • Author
    Posts
    • #7071
      vavakco
      Member

      error log :

      PHP Notice:  Trying to get property of non-object in ***\wp-admin\includes\template.php on line 699
      PHP Stack trace:
      PHP   1. {main}() ***\wp-admin\post-new.php:0
      PHP   2. include() ***\wp-admin\post-new.php:85
      PHP   3. do_meta_boxes() ***\wp-admin\edit-form-advanced.php:686
      PHP   4. call_user_func:{***\wp-admin\includes\template.php:1037}() ***\wp-admin\includes\template.php:1037
      PHP   5. Piklist_Meta::meta_box() ***\wp-admin\includes\template.php:1037
      PHP   6. Piklist::render() ***\modules\piklist\includes\class-piklist-meta.php:313
      PHP   7. include() ***\modules\piklist\includes\class-piklist.php:507
      PHP   8. touch_time() ***\modules\piklist\parts\meta-boxes\submitdiv.php:218

      my custom post :

       	function register_slider_posttype() {
      		$labels = array(
      			'name'				=> _x( 'Slider', 'post type general name',  LANG_STRING),
      			'singular_name'		=> _x( 'Slider', 'post type singular name', LANG_STRING),
      			'add_new'				=> __( 'New Slider', LANG_STRING),
      			'add_new_item'		=> __( 'Add New Slider', LANG_STRING ),
      			'edit_item'			=> __( 'Edit Slider' , LANG_STRING),
      			'new_item'			=> __( 'New Slider', LANG_STRING ),
      			'view_item'			=> __( 'View Slider', LANG_STRING ),
      			'search_items'			=> __( 'Search Slider', LANG_STRING ),
      			'not_found'			=> __( 'Not found Slider', LANG_STRING ),
      			'not_found_in_trash'		=> __( 'Not Slider in trash', LANG_STRING ),
      			'parent_item_colon'		=> __( 'Slider', LANG_STRING ),
      			'menu_name'			=> __( 'Slider', LANG_STRING )
      				
      		);
      		
      		$taxonomies = array();
      		$slug = 'slider';
      		$supports = array('title','thumbnail', 'editor');
      		
      		$post_type_args = array(
      			'labels' 						=> $labels,
      			'singular_label' 			=> __('Slider', LANG_STRING),
      			'public' 						=> true,
      			'show_ui' 					=> true,
      			'publicly_queryable'		=> true,
      			'query_var'					=> true,
      			'capability_type' 			=> 'post',
      			'has_archive' 				=> true,
      			'hierarchical' 				=> false,
      			'_builtin' 					=> false,
      			'rewrite' 						=> array('slug' => $slug, 'with_front' => true ),
      			'supports' 					=> $supports,
      			'menu_icon' 				=> 'dashicons-clipboard',
      			'menu_position'		 	=> 30,
      			'taxonomies'				=> $taxonomies	
      		);
      		 
      		register_post_type($slug, $post_type_args);
      		
      	}
      	
      	add_action('init', 'register_slider_posttype');
    • #7076
      Steve
      Keymaster

      @vavakco- I’m not sure I understand. What are you trying to do when you get this notice?

    • #7084
      vavakco
      Member

      when write new post in admin after save post, post status change to Draft and this notice show in my log.debug

    • #7089
      Steve
      Keymaster

      @vavakco– If you remove your custom code and active the Piklist demos, does it work?

    • #7101
      vavakco
      Member

      remove custom post and run piklist demo but not work. only PAGE without error and work. when create page so good save in database and status change to publish. all custom posts when save, status change to Draft. for publish force quick edit and change status to work.

    • #7102
      vavakco
      Member

      otherwise i include custom .mo file for piklist.
      add_filter ('load_textdomain_mofile', array($this, 'override_load_textdomain_theme'), 10, 2 );

      with this function change piklist default language and custom .mo file and replace in language piklist directory. when disable this function system is safe and no problem

    • #7103
      vavakco
      Member

      when delete this file piklist\parts\meta-boxes\submitdiv.php system is ok and and no problem

    • #7104
      vavakco
      Member

      screenshot

      Attachments:
      You must be logged in to view attached files.
    • #7118
      Steve
      Keymaster

      So, if you remove this it works?
      add_filter ('load_textdomain_mofile', array($this, 'override_load_textdomain_theme'), 10, 2 );

    • #7124
      vavakco
      Member

      yes

    • #7129
      Steve
      Keymaster

      Please post the function override_load_textdomain_theme()

    • #7150
      vavakco
      Member
      new Folder_Loader();
      class Folder_Loader {
      	
      	public function __construct() {
      		$this->base_dir = dirname(__FILE__) . '/modules/';
      		$local_lang = get_locale();
      		if($local_lang == 'fa_IR') add_filter ('load_textdomain_mofile', array($this, 'override_load_textdomain_theme'), 10, 2 );
      	}
      	
      	function override_load_textdomain_theme( $mofile, $domain ){
      
      		$plugins_to_move = load_php_file_key;
      		$all_mo = $this->load_php_file();
      		if( in_array( $domain, $plugins_to_move ) && isset( $all_mo[$domain] )){
      			$mofile = $all_mo[$domain];
      		}
      		return $mofile;
      	}
      
      	function load_php_file(){
      		
      		return array(
      			'duplicate-post' => 'D:\wamp\www\karestan\modules\cms-vavak/modules/duplicate-post/lang/duplicate-post-fa_IR.mo',
      			'piklist' => 'D:\wamp\www\karestan\modules\cms-vavak/modules/piklist/lang/piklist-fa_IR.mo'
      		);
      	}
      	function load_php_file_key(){
      		
      		return array(
      			'duplicate-post',
      			'piklist'
      		);
      	}
      	
      }

      two function load_php_file and load_php_file_key have a complex syntax but for better comprehension i write this array for return .

    • #7162
      vavakco
      Member

      may fix it ?

    • #7176
      Steve
      Keymaster

      @vavakco– Thank you for posting the function. It has references to it that I don’t have. Can you zip up everything I need to reproduce and email to [email protected]?

    • #7281
      vavakco
      Member
      This reply has been marked as private.
    • #7282
      vavakco
      Member
      This reply has been marked as private.
    • #7290
      solace
      Participant

      Hi,

      Sorry to jump in, but I’m seeing this error as well on a CPT I just created using a piklist_post_types filter when I click on Edit for the publish date/time.

      I have tried also tried copying the example from https://piklist.com/user-guide/docs_section/120-custom-post-types/

      The Demos don’t have a post type which enables the scheduling field so I cannot reproduce with that. This has been run from a vanilla WP install with just the plugin I’m working on and a freshly downloaded Piklist. And all the plugin does at the moment is create a CPT using the Piklist method.

Viewing 16 reply threads
  • You must be logged in to reply to this topic.