register_hooks(); } /** * Registers the hooks for displaying the content of Elementor templates * in the page templates. * * @since 1.0.0 */ public function register_hooks() { add_action('abcbiz_single_post_content', array($this, 'single_post_content_elementor'), 999); add_action('abcbiz_single_page_content', array($this, 'single_page_content_elementor'), 999); add_action('abcbiz_404_page_content', array($this, 'single_404_page_content_elementor'), 999); add_action('abcbiz_search_page_content', array($this, 'search_page_content_elementor'), 999); add_action('abcbiz_archive_page_content', array($this, 'archive_page_content_elementor'), 999); } /** * Single post content hook for Elementor template. * * If an Elementor template exists for the 'single_post' type, it will be rendered. * Otherwise, the post content will be rendered using the_content(). * * @param WP_Post $post The post object. */ public function single_post_content_elementor($post) { $template_id = ABCBizThemeBuilder::get_template_id('single_post'); if (!empty($template_id)) { echo \Elementor\Plugin::instance()->frontend->get_builder_content_for_display($template_id); } else { the_content(); } } /** * Single page content hook for Elementor template. * * If an Elementor template exists for the 'single_page' type, it will be rendered. * Otherwise, the page content will be rendered using the_content(). * * @param WP_Post $page The page object. * * @since 1.0.0 */ public function single_page_content_elementor($page) { $template_id = ABCBizThemeBuilder::get_template_id('single_page'); if (!empty($template_id)) { echo \Elementor\Plugin::instance()->frontend->get_builder_content_for_display($template_id); } else { the_content(); } } /** * Hook for rendering the 404 page content for Elementor template. * * If an Elementor template exists for the '404_page' type, it will be rendered. * Otherwise, a fallback content will be rendered including the search title, search form, and a list of search results. * * @param WP_Query $error The error query object. */ public function single_404_page_content_elementor($error) { $template_id = ABCBizThemeBuilder::get_template_id('404_page'); if (!empty($template_id)) { echo \Elementor\Plugin::instance()->frontend->get_builder_content_for_display($template_id); } else { '
' . esc_html__('No posts found in this archive.', 'abcbiz-addons') . '
'; } } } }