Skip to content

Commit

Permalink
Merge branch 'release/2.28.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
JiveDig committed May 10, 2023
2 parents 434e042 + a144000 commit fa9bd43
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 13 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 2.28.1 (5/10/23)
* Fixed: Wrong ID being returned on front page for site layout in some scenarios.
* Fixed: Replace deprecated `get_page_by_title()` function.
* Fixed: Mai Inspire demos not working in Mai Setup Wizard.

## 2.28.0 (5/5/23)
* Changed: Update ACF to 6.1.6.
* Fixed: More thorough handling of markup processing to make sure valid markup is returned.
Expand Down
4 changes: 2 additions & 2 deletions config/inspire.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

return [
'demos' => [
// 'home-garden' => 35,
'home-garden' => 'https://demo.bizbudding.com/inspire-home-garden/wp-content/uploads/sites/35/mai-engine/',
'health-beauty' => 'https://demo.bizbudding.com/inspire-health-beauty/wp-content/uploads/sites/36/mai-engine/',
// 'travel' => 37,
'travel' => 'https://demo.bizbudding.com/inspire-travel/wp-content/uploads/sites/37/mai-engine/',
],
'global-styles' => [
'colors' => [
Expand Down
8 changes: 4 additions & 4 deletions lib/admin/setup-wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,10 @@ function mai_after_setup_wizard_import( $demo ) {
$home = 'Home - ' . mai_convert_case( mai_get_active_theme() . ' ' . $demo, 'title' );

// Assign front page and posts page.
$front = get_page_by_title( $home );
$front = $front ?: get_page_by_title( 'Home' ); // Fallback if no home with demo name.
$blog = get_page_by_title( 'Blog' );
$shop = get_page_by_title( 'Shop' );
$front = mai_get_page_by_title( $home );
$front = $front ?: mai_get_page_by_title( 'Home' ); // Fallback if no home with demo name.
$blog = mai_get_page_by_title( 'Blog' );
$shop = mai_get_page_by_title( 'Shop' );

if ( $front ) {
update_option( 'page_on_front', $front->ID );
Expand Down
4 changes: 2 additions & 2 deletions lib/classes/class-mai-setup-wizard-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ class Mai_Setup_Wizard_Ajax extends Mai_Setup_Wizard_Service_Provider {
*/
public function add_hooks() {
add_action( 'wp_ajax_mai_setup_wizard_welcome', [ $this, 'step_welcome' ] );
add_action( 'wp_ajax_mai_setup_wizard_demo', [ $this, 'step_demo' ] );
add_action( 'wp_ajax_mai_setup_wizard_demo', [ $this, 'step_demo' ] );
add_action( 'wp_ajax_mai_setup_wizard_plugins', [ $this, 'step_plugins' ] );
add_action( 'wp_ajax_mai_setup_wizard_content', [ $this, 'step_content' ] );
add_action( 'wp_ajax_mai_setup_wizard_done', [ $this, 'step_done' ] );
add_action( 'wp_ajax_mai_setup_wizard_done', [ $this, 'step_done' ] );
}

/**
Expand Down
11 changes: 9 additions & 2 deletions lib/functions/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,15 @@ function mai_site_layout() {
else {

if ( is_singular() || ( is_home() && ! genesis_is_root_page() ) ) {
$post_id = is_home() ? get_option( 'page_for_posts' ) : null;
$site_layout = genesis_get_custom_field( '_genesis_layout', $post_id );
$post_id = null;

if ( is_home() ) {
$post_id = get_option( 'page_for_posts' );
} elseif ( is_front_page() ) {
$post_id = get_option( 'page_on_front' );
}

$site_layout = genesis_get_custom_field( '_genesis_layout', $post_id ); // Function handles null.

} elseif ( is_category() || is_tag() || is_tax() ) {

Expand Down
32 changes: 32 additions & 0 deletions lib/functions/utilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -1992,6 +1992,38 @@ function mai_sanitize_get( $param, $function = 'esc_html' ) {
return isset( $_GET[ $param ] ) ? $function( $_GET[ $param ] ) : null;
}

/**
* Undocumented function
*
* @access private
*
* @param string $title The page title.
* @param string $post_type The post type.
*
* @return WP_Post|false
*/
function mai_get_page_by_title( $title, $post_type = 'page' ) {
$page = false;
$query = new WP_Query(
[
'post_type' => $post_type,
'title' => $title,
'post_status' => 'all',
'posts_per_page' => 1,
'ignore_sticky_posts' => true,
'no_found_rows' => true,
'update_post_term_cache' => false,
'update_post_meta_cache' => false,
]
);

if ( ! empty( $query->post ) ) {
$page = $query->post;
}

return $page;
}

/**
* Gets all non latin locales in WP.
*
Expand Down
2 changes: 1 addition & 1 deletion mai-engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Plugin URI: https://bizbudding.com/mai-theme/
* GitHub Plugin URI: https://github.com/maithemewp/mai-engine/
* Description: The required plugin to power Mai child themes.
* Version: 2.28.0
* Version: 2.28.1
* Author: BizBudding
* Author URI: https://bizbudding.com/
* Text Domain: mai-engine
Expand Down
4 changes: 2 additions & 2 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => 'maithemewp/mai-engine',
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'reference' => '92cf6c82758b061aea32fa6574d1aa2395724e2d',
'reference' => 'a570d015ba52755d5e6dada187c8b90acbc80e47',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand Down Expand Up @@ -319,7 +319,7 @@
'maithemewp/mai-engine' => array(
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'reference' => '92cf6c82758b061aea32fa6574d1aa2395724e2d',
'reference' => 'a570d015ba52755d5e6dada187c8b90acbc80e47',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand Down

0 comments on commit fa9bd43

Please sign in to comment.