Created
January 3, 2018 11:39
-
-
Save SJ-James/2034db86ed54dea09fa0ed4920261660 to your computer and use it in GitHub Desktop.
Clear Local Storage Button For Divi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function ClearLocalCacheButton() { ?> | |
// Create Button | |
<a href="#" onclick="ClearLocalCache()" class="et-pb-layout-buttons et-pb-layout-buttons-cache" title="Clear Cache"> | |
<span>Clear Cache</span> | |
</a> | |
<script type="text/javascript"> | |
// Move Button to Divi Tabs | |
jQuery(window).load(function(){ | |
jQuery(".et-pb-layout-buttons-cache").insertAfter(jQuery(".et-pb-layout-buttons-clear")); | |
}); | |
function ClearLocalCache() { | |
// Clear Storage and Alert User | |
alert("Local storage has been cleared. Update the page now."); | |
window.localStorage.clear() | |
} | |
</script> | |
<?php } | |
add_action('admin_footer', 'ClearLocalCacheButton'); |
Working great for me. Thanks very much for the share! :)
Hi !
Is it still useful for new Divi version ?
Many thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
need help
What am i doing wong? i inserted a code in /themes/ExtraChild/functions.php
i deleted
Parse error: syntax error, unexpected '<' in /themes/ExtraChild/functions.php on line 34
lines 34-48:
`<!a href="#" onclick="ClearLocalCache()" class="et-pb-layout-buttons et-pb-layout-buttons-cache" title="Clear Cache">
Clear Cache
What's wrong with syntax of php file? it start from <?php and end ?> explain this please
function ClearLocalCacheButton() { ?>`