GeoDirectory is the leading Directory Plugin for WordPress. Compatible with Gutenberg and the most popular page builders such as Elementor, Oxygen, Beaver Builder and Divi. GeoDirectory is the only solution for WordPress that can scale to millions of listings and high traffic.
Description of the Change
This pull request addresses the issue where a PHP fatal error occurs in GeoDirectory version 2.3.19 or higher when Elementor is not installed. The error is triggered in the class-geodir-elementor.php file.
Approach
The proposed change involves adding a conditional check to ensure the Elementor class exists before attempting to use it. This prevents the fatal error and allows GeoDirectory to function normally even when Elementor is not present.
Code Changes
Modified get_elementor_document function in class-geodir-elementor.php:
public static function get_elementor_document( $page_id ) {
// Check if Elementor Plugin class exists to ensure compatibility
if ( class_exists( '\Elementor\Plugin' ) ) {
// If Elementor is available, get the document
$document = \Elementor\Plugin::$instance->documents->get( (int) $page_id );
return $document;
} else {
// Return null if Elementor is not active or installed
// This prevents errors and ensures graceful degradation
return null;
}
}
Description of the Change This pull request addresses the issue where a PHP fatal error occurs in GeoDirectory version 2.3.19 or higher when Elementor is not installed. The error is triggered in the
class-geodir-elementor.php
file.Approach The proposed change involves adding a conditional check to ensure the Elementor class exists before attempting to use it. This prevents the fatal error and allows GeoDirectory to function normally even when Elementor is not present.
Code Changes Modified
get_elementor_document
function inclass-geodir-elementor.php
:Related Issue https://github.com/AyeCode/geodirectory/issues/2498