pejamide
Forum Replies Created
-
Forum: Plugins
In reply to: [Code Snippets] How to pass data to code snippet?I created the functions.php for my theme-child:
<?php add_action('wp_enqueue_scripts', 'child_enqueue_styles', 99); function child_enqueue_styles(){ $parent_style = 'parent-style'; wp_enqueue_style($parent_style, get_template_directory_uri() . '/style.css'); wp_enqueue_style('child-style', get_stylesheet_directory_uri() . '/style.css', array($parent_style)); } if(get_stylesheet() !== get_template()){ add_filter('pre_update_option_theme_mods_' . get_stylesheet(), function($value, $old_value){ update_option('theme_mods_' . get_template(), $value); return $old_value;}, 10, 2); add_filter('pre_option_theme_mods_' . get_stylesheet(), function($default){return get_option('theme_mods_' . get_template(), $default);});} /*---Initialize globald data ---*/ add_action('after_setup_theme', function(){ $value1 = $GLOBALS['bbl_var1']; $value2 = $GLOBALS['bbl_var2']; $value3 = $GLOBALS['bbl_var3'];}); $GLOBALS['bbl_var1'] = 'JdV111'; $GLOBALS['bbl_var2'] = 'JdV222'; $GLOBALS['bbl_var3'] = 'JdV333'; ?>
And my PHP-snippet:
<?php echo '<br>' . $GLOBALS['bbl_var1']; echo '<br>' . $GLOBALS['bbl_var2']; echo '<br>' . $GLOBALS['bbl_var3'];
I got the PHP message:
Warning: Undefined array key "bbl_var1" in /......./wp-content/plugins/insert-php-code-snippet/shortcode-handler.php(100) : eval()'d code on line 2
What should I have done wrong?
Forum: Plugins
In reply to: [Code Snippets] How to pass data to code snippet?2:
If I use three $GLOBALS[‘bbl_var1] = ‘111’, $GLOBALS[‘bbl_var] = ‘222’ and $GLOBALS[‘bbl_var3] = ‘333’, where and what I should put such initialization in functions.php?
And what should is code in a PHP snippet in order to read three $GLOABLS variables?Forum: Plugins
In reply to: [Code Snippets] How to pass data to code snippet?Thank you for your reponse, but I have two new questions:
1:
What and how I should use instead of $GLOBALS variables? Please give me two examples:
The one in functions.php for initialization of three variables (bbl_var1, bbl_var2 and bbl_var3) andthe other for PHP snippet in order to read three variables: bbl_var1, bbl_var2 and bbl_var3.
Forum: Plugins
In reply to: [Insert PHP Code Snippet] plugin insert-php-code-snippet errorWhere can I find ‘Trash’ in order to see if the “Snippet Preview” page is there?