Archived topic
simple php
8 replies · Started by Tony on February 6, 2016
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
Was Simple PHP activated?
Alternatively you can use this plugin: https://en-ca.wordpress.org/plugins/code-snippets/
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.
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.
Any reason you're updating manually? You should be able to do so in "Appearance > Themes"?
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
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 :)
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
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;
}
