/home/techb158/public_html/wp-content/plugins/kirki/includes/Admin
NameSizeModeActions
views/-0755rm
AdminMenu.php40790644editdlrm
EditWithButton.php42230644editdlrm
PostActions.php4220644editdlrm
Edit: /home/techb158/public_html/wp-content/plugins/kirki/includes/Admin/EditWithButton.php (4223B)
ID ) ) { // Check if the editor mode is set to "Kirki" and if the user has edit access $editor_mode = HelperFunctions::is_editor_mode_is_kirki( $post->ID ); if ( $editor_mode && HelperFunctions::user_has_post_edit_access( $post->ID ) ) { // Fetch the post URLs using your existing helper functions $post_url_arr = HelperFunctions::get_post_url_arr_from_post_id( $post->ID, array( 'editor_url' => true, 'ajax_url' => true, ) ); // Add the custom button to the admin bar $wp_admin_bar->add_node( array( 'id' => 'edit_with_kirki', // Unique ID for the button 'title' => '  ' . esc_html__( 'Edit with Kirki', 'kirki' ), // Button content 'href' => $post_url_arr['editor_url'], // URL to the XYZ editor 'ajaxUrl' => $post_url_arr['ajax_url'], 'action' => KIRKI_EDITOR_ACTION, 'isEditorModeIsKirki' => $editor_mode, 'postId' => get_the_ID(), 'nonce' => wp_create_nonce( 'wp_rest' ), ) ); } } AdminMenu::add_kirki_admin_styles(); } /** * Filter Post Row Actions. * * Let the Document to filter the array of row action links on the Posts list table. * * @param array $actions wp actions. * @param \WP_Post $post wp post. * * @return array */ public function filter_post_row_actions( $actions, $post ) { $editor_mode = HelperFunctions::is_editor_mode_is_kirki( $post->ID ); if ( $editor_mode && HelperFunctions::user_has_post_edit_access( $post->ID ) ) { $editor_url = HelperFunctions::get_post_url_arr_from_post_id( $post->ID, array( 'editor_url' => true ) )['editor_url']; $actions[ 'edit_with_' . 'kirki' ] = sprintf( '%2$s', $editor_url, esc_html__( 'Edit with Kirki', 'kirki' ) ); } return $actions; } /** * Add custom link in toolbar and click functionality * * @param string $hook wp hook or page name. * * @return void */ public function add_custom_button_click_functionality( $hook ) { global $post; if ( 'post-new.php' === $hook || 'post.php' === $hook ) { $version = KIRKI_VERSION; $editor_mode = HelperFunctions::is_editor_mode_is_kirki( get_the_ID() ); $post_url_arr = HelperFunctions::get_post_url_arr_from_post_id( get_the_ID(), array( 'editor_url' => true, 'ajax_url' => true, 'rest_url' => true, ) ); wp_enqueue_script( 'custom_link', KIRKI_ASSETS_URL . 'js/admin/custom-link-in-toolbar.js', array(), $version, true ); wp_localize_script( 'custom_link', 'kirki_admin', array( 'postEditURL' => $post_url_arr['editor_url'], 'ajaxUrl' => $post_url_arr['ajax_url'], 'restUrl' => $post_url_arr['rest_url'], 'action' => KIRKI_EDITOR_ACTION, 'isEditorModeIsKirki' => $editor_mode, 'postId' => get_the_ID(), 'nonce' => wp_create_nonce( 'wp_rest' ), ) ); } } }