Skip to content

Commit

Permalink
Merge pull request #4010 from Codeinwp/fix/about_page_whitelabel
Browse files Browse the repository at this point in the history
fix: about page display when using whitelabel …
  • Loading branch information
preda-bogdan authored Jul 12, 2023
2 parents 6bbf029 + 30ff906 commit b4e0a4b
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions inc/admin/dashboard/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,33 @@ public function init() {
add_action( 'admin_menu', [ $this, 'register' ] );
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue' ] );
add_action( 'init', array( $this, 'register_settings' ) );
add_action( 'init', array( $this, 'register_about_page' ), 1 );
}

/**
* Add the about page with respect to the white label settings.
*
* @return void
*/
public function register_about_page() {
$theme = wp_get_theme();
$filtered_name = apply_filters( 'ti_wl_theme_name', $theme->__get( 'Name' ) );
$slug = $theme->__get( 'stylesheet' );

if ( empty( $slug ) || empty( $filtered_name ) ) {
return;
}

// We check if the name is different from the filtered name,
// if it is, the whitelabel is in use and we should not add the about page.
// this check allows for child themes to use the about page.
if ( $filtered_name !== $theme->__get( 'Name' ) ) {
return;
}

add_filter(
'neve_about_us_metadata',
function () {
function () use ( $filtered_name ) {
return [
// Top-level page in the dashboard sidebar
'location' => 'neve-welcome',
Expand All @@ -101,11 +124,10 @@ function () {
'has_upgrade_menu' => ! defined( 'NEVE_PRO_VERSION' ),
// Upgrade menu item link & text
'upgrade_link' => tsdk_utmify( esc_url( 'https://themeisle.com/themes/neve/upgrade/' ), 'aboutfilter', 'nevedashboard' ),
'upgrade_text' => __( 'Upgrade', 'neve' ) . ' ' . $this->theme_args['name'],
'upgrade_text' => __( 'Upgrade', 'neve' ) . ' ' . $filtered_name,
];
}
);

}

/**
Expand Down

0 comments on commit b4e0a4b

Please sign in to comment.