diff --git a/elementor/container.php b/elementor/container.php index 8527b22..c4c7b43 100644 --- a/elementor/container.php +++ b/elementor/container.php @@ -153,7 +153,7 @@ function post_type_container(){ function post_type_content($content){ global $post,$wp_query; - if ($wp_query->queried_object_id != $post->ID && !defined('ARCHIVE_LOOP')) return $content; // prevents infinite loop + if ($wp_query->queried_object_id != $post->ID && !defined('ARCHIVE_LOOP')) return parse_content($content); // prevents infinite loop if (is_single()) { $after="[single]"; @@ -163,7 +163,7 @@ function post_type_content($content){ $page = get_current_template($after); // get the template if($page) return parse_content(get_eletheme($page->ID),$post,$content); - return $content; + return parse_content($content); } @@ -250,7 +250,11 @@ function parse_content($t,$post=NULL,$content=""){ // add your own custom vars - //$custom_vars=apply_filters( 'custom_vars', 'custom' ); //soon + $custom_vars=apply_filters( 'eletheme_vars', $custom_vars ); + + foreach($custom_vars as $key=>$value){ + $$key=$value; + } /** end seting custom vars **/ // replacing the keystrings from the template with the actual values. (ie for $content you have {content}) @@ -301,15 +305,7 @@ function passtheid( $widget ) { } -/*-----------------------------------------------------------------------------------*/ -/* Set the current(global) post to widget rendering not the elementor_library theme post -/*-----------------------------------------------------------------------------------*/ -add_action('elementor/frontend/widget/before_render', function($widget){ - global $wp_query,$post; - $post = get_post( $wp_query->post->ID ); - setup_postdata( $post ); -}, 10, 1); /*-----------------------------------------------------------------------------------*/ /* Define header and footer constants /*-----------------------------------------------------------------------------------*/ @@ -323,7 +319,7 @@ function set_eletheme(){ $page = get_page_by_title('[body]', OBJECT, 'elementor_library'); if($page) list($myhead,$myfooter)=explode("{{content}}",get_eletheme($page->ID)); - define( 'ELE_HEADER',clean_header($myhead)); - define( 'ELE_FOOTER',$myfooter); + define( 'ELE_HEADER',parse_content(clean_header($myhead))); + define( 'ELE_FOOTER',parse_content($myfooter)); } add_action( 'wp_head', 'set_eletheme', 23 ); \ No newline at end of file diff --git a/functions.php b/functions.php index c9961f9..59272ee 100644 --- a/functions.php +++ b/functions.php @@ -4,6 +4,14 @@ remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); remove_action( 'wp_print_styles', 'print_emoji_styles' ); + +// Add custom keywords to the eletheme +add_filter( 'eletheme_vars', 'new_keywords'); +function new_keywords( $custom_vars ) { + $custom_vars['current_year']=date('Y'); + return $custom_vars; +} + add_action( 'after_setup_theme', 'eletheme_setup' ); function eletheme_setup() { diff --git a/readme.txt b/readme.txt index c544f2d..d9d6cef 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: Theme builder, Elementor Requires at least: 4.0 Tested up to: 4.9.2 -Stable tag: 1.0.8 +Stable tag: 1.1.0 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -73,6 +73,11 @@ Check https://www.eletemplator.com/ or https://github.com/dudaster/eletheme == Changelog == += 1.1.0 = +* added the ability to insert new keywords and values into tha page +* added {{current_year}} keyword +* fixed issue with Elementor PRO 2 + = 1.0.9 = * fixed issue with Eementor PRO Posts Widget diff --git a/style.css b/style.css index 7538792..87654e0 100644 --- a/style.css +++ b/style.css @@ -3,8 +3,8 @@ Theme Name: Eletheme Theme URI: https://www.eletemplator.com Author: Liviu Duda Author URI: https://www.leadpro.ro -Description: Theme builder for Elementor. It works with Elementor but upgrade to Elementor PRO to unlock it's full potential (it worths every penny). Soon we'll come with a complementary plugin that can help you build woocommerce product pages and custom archive post lists. Check other Elementor addons to help build your desired website. -Version: 1.0.9 +Description: Theme builder for Elementor. It works with Elementor 2.x and Elementor PRO 2.x. Check other Elementor addons to help build your desired website. +Version: 1.1.0 License: GNU General Public License License URI: https://www.gnu.org/licenses/gpl.html Tags: Theme builder, elementor