• Found another bug in zoom-lite. Seems that when editing a post, the wp-pointer associated with the post format section doesn’t get translated properly, which means that it pops up with the content as ‘undefined’, and can never be permanently dismissed. Bit annoying, as it pops up every time you edit a post.

    I think the fix is to re-order the point at which the script gets enqueued, so that it comes after the localisation:

    function zoom_post_formats_script_handle( $hook ) {
    	
    	// Only load on posts, pages
        if ( !in_array( $hook, array( 'post.php', 'post-new.php' ) ) ) return;
    
    	$localized_array = array( 'gallery_count' => zoom_gallery_count() );
    	
    	// Check first before Enqueue WP Pointer
        $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
    
        if ( ! in_array( 'zoom_post_format_pointer', $dismissed ) ) {
    		
            wp_enqueue_style( 'wp-pointer' );
    		wp_enqueue_script( 'wp-pointer' );
    		
    		$localized_array['is_rtl'] = is_rtl();
    		$localized_array['title'] = esc_html__( 'ZOOM Theme' , 'zoom-lite' );
    		$localized_array['content'] = esc_html__( 'The following Post Formats will make you more easily to display image gallery, video or music player.' , 'zoom-lite' );
    			
    	}
    	
    	wp_localize_script( 'zoom-post-formats', 'zomm_lclz', $localized_array );
    	
    	// Moving this line down to here stops the undefined wp-pointer popping up
    	wp_enqueue_script( 'zoom-post-formats', get_template_directory_uri() . '/inc/admin/assets/js/post-formats.js', array( 'jquery' ) );
    }
  • The topic ‘Bug-Fix: “Undefined” in Wp-pointer while editing posts’ is closed to new replies.