Possible to Add Ajax Considerations?
-
The plugin seems to be working great, but posts loaded via ajax (a load more posts button for example) don’t show properly.
Checking “Display Guest Author in Author Column in Post list/admin” triggers the $admin variable to be true, which allows the guest author name to show, but this doesn’t cover links, description, etc.
Wondering if it could be considered to modify the conditionals around the filter to include wp_doing_ajax to allow those filters to apply to ajax calls to more posts. Something like this (the else would have to be changed as well).
if (!is_admin() || $admin || wp_doing_ajax() ) { add_filter( 'the_author', array( $this, 'guest_author_name' ), 12 ); add_filter( 'get_the_author_display_name', array( $this, 'guest_author_name' ), 12 ); } if (!is_admin() || wp_doing_ajax() ) { add_action( 'the_post', array($this, 'register_author'), 10); add_filter( 'author_link', array( $this, 'guest_author_link' ), 12 ); add_filter( 'get_the_author_link', array( $this, 'guest_author_link' ), 12 ); add_filter( 'get_the_author_url', array( $this, 'guest_author_link' ), 21 ); add_filter( 'author_description', array( $this, 'guest_author_description'), 12) ; add_filter( 'get_the_author_description', array( $this, 'guest_author_description' ), 12 ) ; add_filter( 'get_the_author_id', array( $this, 'guest_author_id' ), 12 ) ; add_filter( 'author_id', array( $this, 'guest_author_id' ), 12 ); add_filter( 'get_avatar', array( $this, 'guest_author_avatar' ), 40, 1 ); } if( is_admin() ){ add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) ); add_action( 'save_post', array( $this, 'save' ) ); $options = get_option( 'guest_author_name_settings' ); $quickedit = isset( $options['guest_author_name_quickedit'] ) ? true : false ; if ( $quickedit ) { add_action( 'quick_edit_custom_box', array( $this, 'add_quick_meta_box' ), 10, 2 ) ; add_action( 'manage_posts_custom_column', array( $this, 'render_post_columns' ), 10, 2 ) ; add_filter( 'manage_edit-post_columns', array( $this, 'change_posttype_columns' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'guest_admin_scripts' ) ); } }
Just wanted to get your thoughts and see if this is something that would be feasible in future releases.
Cheers,
Matt
- The topic ‘Possible to Add Ajax Considerations?’ is closed to new replies.