Black Friday Sale! Get $20 off GP Premium, $40 off our new Lifetime license, and 45% off license renewals/extensions! Learn more

[Resolved] simple php

Home Forums Support simple php

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #170955
    Tony

    Tried putting this

    add_filter( ‘generate_back_to_top_start_scroll’, ‘generate_back_to_top_start_scroll’ );
    function generate_back_to_top_start_scroll()
    {
    return 100;
    }

    in functions.php and then found simple php.
    Restored functions.php to a backup.
    Added code to simple php. Back to top button no longer works.
    I have deleted code from simple php but still nothing.
    Cheers
    Tony

    #171010
    Tom
    Lead Developer
    Lead Developer

    Was Simple PHP activated?

    Alternatively you can use this plugin: https://en-ca.wordpress.org/plugins/code-snippets/

    #171041
    Tony

    When I put the code at the top of functions.php it didn’t seem to work.
    I set the value at 1000 to see how the button movement changed at which point the back to top button stopped working.

    I restored the original functions.php and installed an activate simple php.
    I tried th code in it and also tried removing it but I cannot get the back to top function working again.

    I have tried enabling and disabling the back to top function but still not working.

    Have my changes affected the main php?

    The issue is that the function has stopped working.

    • This reply was modified 4 years, 9 months ago by Tony.
    #171050
    Tony

    More info:

    I found that the theme needed an update – never noticed before.
    Updated the theme – back to top button returned.

    Re-activated Simple php and added the code which I got from your post.

    add_filter( ‘generate_back_to_top_start_scroll’, ‘generate_back_to_top_start_scroll’ );
    function generate_back_to_top_start_scroll()
    {
    return 100;
    }

    Button stops working.

    remove code from simple php and save – no button
    deactivate simple php – no button.

    I renamed the GeneratePress folder via FTP and RE INSTALLED THE LATEST VERSION via upload. – button is back again.

    PLEASE CONFIRM IF I HAVE LOST ANY SETTINGS DOING THE RE-INSTALL.
    Is it safe to delete the old folder?

    Which file is being changed? I don’t think I’ll try the code again.

    #171121
    Tom
    Lead Developer
    Lead Developer

    Any reason you’re updating manually? You should be able to do so in “Appearance > Themes”?

    #171131
    Tony

    Hi Tom – In trying to get the back-to-top feature working I did the GeneratePress update via the dashboard and that fixed the problem.

    When it broke again the only (simplest way) to repair it was to re-install the theme so I renamed the origianal directory and installed the theme again from a zip file.

    I have no idea why adding that code to the php killed the back-to-top feature but the only way to get it working was a re-install.

    So my questions are:
    Have I lost anything by re-installing? (I never make changes to the theme files)
    Is it safe to delete the old folder?

    Cheers
    Tony

    #171188
    Tom
    Lead Developer
    Lead Developer

    That’s odd – even if that function isn’t working it shouldn’t break anything, it’s just a feature.

    You haven’t lost anything by re-installing – all of your settings are stored in the database which isn’t touched by removing files.

    You’re safe to delete the old folder as long as you didn’t upload anything custom in there 🙂

    #171239
    Tony

    I think it’s the code snippet – does something that zaps the back-to-top button.
    It’s not broken now so not gonna try and fix it – moving on.
    Cheers
    Tony

    #171372
    Tom
    Lead Developer
    Lead Developer

    Just tested it and it’s working great on this end.

    I switched it to 10 so the change was obvious.

    add_filter( 'generate_back_to_top_start_scroll', 'generate_back_to_top_start_scroll' );
    function generate_back_to_top_start_scroll()
    {
    	return 10;
    }
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.