Support community for TTG plugins and products.
NOTICE
The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.
This forum is now closed, and exists here as a read-only archive.
You are not logged in.
Pages: 1
Hi all,
I added a script to the wordpress functions.php and cannot login anymore (script is working). I think I placed it wrong:
functions.php:
<?php
if ( is_admin() ) {
require get_template_directory() . '/inc/theme_admin.php';
}
require get_template_directory() . '/inc/theme_setup.php';
require get_template_directory() . '/inc/theme_enqueue.php';
require get_template_directory() . '/inc/theme_options.php';
require get_template_directory() . '/inc/theme_media.php';
require get_template_directory() . '/inc/theme_menus.php';
require get_template_directory() . '/inc/theme_widgets.php';
require get_template_directory() . '/inc/theme_posts.php';
require get_template_directory() . '/inc/cleaner_gallery.php';
function enqueue_custom_script() {
if( wp_script_is('jquery','done') ){ ?>
<script>
(function($) {
$("ul.menu a[href='" + window.location.pathname + "']").addClass("selected").parents('li').children().addClass('selected');
})( jQuery );
</script>
<?php }}
add_action('wp_footer', 'enqueue_custom_script', 22);
?>
Please help :-)
Best regards,
Oliver
SOLVED by deleting the last ?>
Last edited by volvoxturbo (2016-11-30 18:48:22)
Offline
The purist in me would always close the php tags, even if it's common practice not to. The initial cause would most likely have been a space or newline after the ?>. Many developers omit that final ?> to avoid issues from accidentally leaving space after it.
Offline
Thank you Ben,
you are right! I closed it with ?> and everything works fine :-)
Best regards,
Oliver
Offline
Pages: 1