• Resolved Heiko Mitschke

    (@antares7)


    Hello!

    I have been using this snippets for years. But now it breaks my site. I can not see the cause of the problem. In the snippet editor I got a white “x” on a red circle with the following message on the last line:

    e is undefined

    The code of the snippet is:

    if(strpos({mehrbezeichnung}, 'keine' ) === false)
    {
    echo '
    	<div class="termin grid-container grid-parent">
    		<div class="datum mobile-grid-100 tablet-grid-20 grid-20">{datum}</div>
    		<div class="beschreibung mobile-grid-100 tablet-grid-80 grid-80">
    		<span class="titel">{titel}</span><span class="zusatz-titel">{zusatztitel}</span>
    		[showhide type="{mehrbezeichnung}" more_text="Mehr Informationen..." less_text="Weniger Informationen..."]{content}[/showhide]
    		</div>		
    	</div>';
    }
    else {
    echo '
    	<div class="termin grid-container grid-parent">
    		<div class="datum mobile-grid-100 tablet-grid-20 grid-20">{datum}</div>
    		<div class="beschreibung mobile-grid-100 tablet-grid-80 grid-80">
    			<span class="titel">{titel}</span><span class="zusatz-titel">{zusatztitel}</span>
    		</div>
    	</div>';
    }

    On the frontend I got this error message:

    Fatal error: Uncaught Error: Undefined constant "keine" in .../PostSnippets/Shortcode.php(110) : eval()'d code:1 Stack trace: #0 .../PostSnippets/Shortcode.php(110): eval() #1 .../PostSnippets/Shortcode.php(63): PostSnippets\Shortcode::phpEval('if(strpos(keine...') #2 .../PostSnippets/Shortcode.php(29): PostSnippets\Shortcode::evaluateSnippet(Array, Array, '') #3 .../wp-includes/shortcodes.php(355): PostSnippets\Shortcode->PostSnippets\{closure}(Array, '', 'Termin') #4 [internal function]: do_shortcode_tag(Array) #5 .../wp-includes/shortcodes.php(227): preg_replace_callback('/\\[(\\[?)(Termin...', 'do_shortcode_ta...', '<h2>Februar</h2...') #6 .../wp-includes/class-wp-hook.php(308): do_shortcode('<h2>Februar</h2...') #7 .../wp-includes/plugin.php(205): WP_Hook->apply_filters('<h2>Februar</h2...', Array) #8 .../wp-includes/post-template.php(255): apply_filters('the_content', '<!-- wp:heading...') #9 .../wp-content/themes/generatepress/content-page.php(73): the_content() #10 .../wp-includes/template.php(785): require('/var/www/web296...') #11 .../wp-includes/template.php(718): load_template('/var/www/web296...', false, Array) #12 .../wp-includes/general-template.php(204): locate_template(Array, true, false, Array) #13 .../wp-content/themes/generatepress/inc/theme-functions.php(568): get_template_part('content', 'page') #14 .../wp-content/themes/generatepress/page.php(34): generate_do_template_part('page') #15 .../wp-includes/template-loader.php(106): include('/var/www/web296...') #16 .../wp-blog-header.php(19): require_once('/var/www/web296...') #17 .../index.php(17): require('/var/www/web296...') #18 {main} thrown in .../PostSnippets/Shortcode.php(110) : eval()'d code on line 1

    Can anyone help with this problem? I would really would be glad if someone could solve the problem.

    I use the latest plugin version and PHP 8.0.

    Thanks in advance!
    Heiko

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Error in PHP snippet’ is closed to new replies.