Viewing 14 replies - 1 through 14 (of 14 total)
  • Ramona

    (@nextend_ramona)

    Hi @xlord

    I can see you’re using W3 Total Cache for caching. Have you cleared its cache after you published the slider?

    Caches work that way that they save your site’s content in a given state and keep displaying that state until the cache is cleared. (Which will start the whole process again, so the new version of the page will be saved.) So the cache needs to be cleared after any change you make on your site.

    Thread Starter xlord

    (@xlord)

    Hello @nextend_ramona

    thank you for your reply.

    I tried to edit the header.php via Fillezila:

    https://jansen-stahl.de/wp-content/uploads/2022/02/Bildschirmfoto-2022-02-11-um-14.36.43.png

    and then clear the cache as you said. After this I became fattal error:

    https://jansen-stahl.de/wp-content/uploads/2022/02/Bildschirmfoto-2022-02-11-um-14.38.55.png

    What am I doing wrong?

    Ramona

    (@nextend_ramona)

    Hi @xlord

    A } is missing from your code which creates a syntax error. Probably that’s the error message you can see in your server’s error log. (And if you’re using the latest WordPress version, it should have sent the error to you in email.)

    The correct code:

    <?php
      if(is_home() || is_front_page()){
        echo do_shortcode('[smartslider3 slider=2]');
      }
    ?>

    Your code:

    <?php
      if(is_home() || is_front_page()){
        echo do_shortcode('[smartslider3 slider=1]');
    ?>

    That’s why the syntax highlighting changes in the editor after this code, to help you figure out that a wrong code was entered. (If you look at the if in line 43, it’s blue, but the one at line 50 is white which indicated that the editor doesn’t recognize the if keyword.)

    When you edit PHP files, make sure you always write code without any errors.

    Thread Starter xlord

    (@xlord)

    Hi @nextend_ramona

    thank you for your reply.

    I repaired the missed } and cleared the cache but without result.

    https://jansen-stahl.de/wp-content/uploads/2022/02/Bildschirmfoto-2022-02-11-um-19.06.21.png

    Now I have parallax effect on my menu tab, what I didn’t want.

    https://jansen-stahl.de/wp-content/uploads/2022/02/Bildschirmfoto-2022-02-11-um-19.06.58-scaled.jpg

    I tried to deactivate all the security plugins, but also without result..
    :-/

    Ramona

    (@nextend_ramona)

    Hi @xlord

    Looking at the screenshot again I noticed what I didn’t see before, that you’re closing the <?php tag after the shortcode, just the codes under are still PHP codes which end up being outside of PHP. So the ?> should be removed from line 46:

    View post on imgur.com


    This is why the following code appears on your page as plain text:

    /* * If a regular post or page, and not the front page, show the featured image. * Using get_queried_object_id() here since the $post global may not be set before a call to the_post(). */ if ( ( is_single() || ( is_page() && ! twentyseventeen_is_frontpage() ) ) && has_post_thumbnail( get_queried_object_id() ) ) : echo '
    '; echo get_the_post_thumbnail( get_queried_object_id(), 'twentyseventeen-featured-image' ); echo '
    '; endif; ?> 

    after removing the ?> these text will disappear as they’ll be parsed as codes again.

    Looking at your page, I can see Smart Slider’s HTML codes in the page source now. However, our JavaScript codes are missing. Looking at the screenshot of your page’s codes again, it seems because the </head> tag is missing. Try adding that to line 23:

    View post on imgur.com

    I think that would fix the problem.

    Thread Starter xlord

    (@xlord)

    Hi @nextend_ramona

    thank you for helping me.

    I removed this code:

    /* * If a regular post or page, and not the front page, show the featured image. * Using get_queried_object_id() here since the $post global may not be set before a call to the_post(). */ if ( ( is_single() || ( is_page() && ! twentyseventeen_is_frontpage() ) ) && has_post_thumbnail( get_queried_object_id() ) ) : echo '
    '; echo get_the_post_thumbnail( get_queried_object_id(), 'twentyseventeen-featured-image' ); echo '
    '; endif; ?> 

    Than I added </head> tag as you describe:
    https://jansen-stahl.de/wp-content/uploads/2022/02/Bildschirmfoto-2022-02-14-um-13.14.16-1.png

    But after that I became the Fatal Error again:

    After removing the smart-slider tag, the site is running good again, but without smart-slider :-/

    Maybe I misunderstood?

    Ramona

    (@nextend_ramona)

    Hi @xlord

    I can’t really spot any obvious problem on the screenshot.

    What’s the exact PHP error message you get? WordPress usually emails you the exact error that occurred, but if you didn’t get that, you could look into your server’s error log, or try to make your site write the error:
    https://smartslider.helpscoutdocs.com/article/1949-error-reporting
    and please send me the log! (Usually it will list the full path to the file and you might want to remove your site URL from that before posting the log.)

    Thread Starter xlord

    (@xlord)

    Hi @nextend_ramona

    thank you for your quick reply.

    Exact PHP error message i get:

    Parse error: syntax error, unexpected end of file in /mnt/web117/d0/12/59107112/htdocs/WordPress_01/wp-content/themes/twentyseventeen/header.php on line 47

    What is wrong on the line 47?

    Plugin Support Gabor

    (@nextendweb_gabor)

    Hi @xlord!

    Now the closing } sign is missing again, so you should add it after the echo do_shortcode line:

    <?php
    if(is_home() || is_front_page()){
        echo do_shortcode('[smartslider3 slider=2]');
    }
    ?>
    Thread Starter xlord

    (@xlord)

    Hi @nextendweb_gabor

    thank you for your reply.

    It seems to go the right way.
    The smart slider is now to see on the website, but under the main menu.

    Before the theme was updated, smart-slider was instead of the header image:
    https://jansen-stahl.de/wp-content/uploads/2022/02/Bildschirmfoto-2022-02-14-um-14.03.21.png

    How can i replace the header image with your cool smart slider 3?

    Ramona

    (@nextend_ramona)

    Hi @xlord

    I recommend following these instructions:
    https://smartslider.helpscoutdocs.com/article/1823-twenty-seventeen-child-theme
    to publish the slider instead of the Twenty Seventeen default image.

    Thread Starter xlord

    (@xlord)

    Hi @nextend_ramona

    thank you for your answer.

    OK i am going to do this child theme now.

    Do I need to delete the tag from the main header.php file?
    Or can I leave it there by creating a Twenty seventeen child theme?

    thanks in advance

    Plugin Support Gabor

    (@nextendweb_gabor)

    Yes, in this case I suggest removing the codepart you added to the header.php file:

    <?php
    if(is_home() || is_front_page()){
        echo do_shortcode('[smartslider3 slider=2]');
    }
    ?>

    as your child theme won’t overwrite this file, so it rather should stay without a slider.

    Thread Starter xlord

    (@xlord)

    Hi @nextendweb_gabor

    than you for your reply.

    After making twenty seventeen child theme I see that all the webpage need to be upgraded. That is quiet complicated.

    Maybe I downgrade the theme and worpdress versions to go the good and normal way, there was.

    I did not await these problems befor I updated the theme and wordpress version..

    :-/

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Slider doesn’t work in header.php after update twenty seventeen’ is closed to new replies.