Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions block-catalog.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
define( 'BLOCK_CATALOG_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
define( 'BLOCK_CATALOG_PLUGIN_INC', BLOCK_CATALOG_PLUGIN_PATH . 'includes/' );
define( 'BLOCK_CATALOG_PLUGIN_FILE', plugin_basename( __FILE__ ) );
define( 'BLOCK_CATALOG_PLUGIN_BASENAME', plugin_basename( __DIR__ . '/block-catalog.php' ) );

define( 'BLOCK_CATALOG_TAXONOMY', 'block-catalog' );

Expand Down
25 changes: 25 additions & 0 deletions includes/classes/ToolsPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class ToolsPage {
*/
public function register() {
add_action( 'admin_menu', [ $this, 'register_page' ] );
add_filter( 'plugin_action_links_' . BLOCK_CATALOG_PLUGIN_BASENAME, array( $this, 'filter_plugin_action_links' ) );
}

/**
Expand Down Expand Up @@ -163,4 +164,28 @@ public function get_settings() {
],
];
}

/**
* Add the action links to the plugin page.
*
* @param array $links The Action links for the plugin.
* @return array Modified action links to include custom link.
*/
public function filter_plugin_action_links( $links ) {

if ( ! is_array( $links ) ) {
return $links;
}

return array_merge(
array(
'index-posts' => sprintf(
'<a href="%s"> %s </a>',
esc_url( admin_url( 'tools.php?page=block-catalog-tools' ) ),
esc_html__( 'Index Posts', 'block-catalog' )
),
),
$links
);
}
}