Community @ The Turning Gate

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.

  • New user registrations are disabled.
  • Users cannot create new topics.
  • Users cannot reply to existing topics.

You are not logged in.

#1 2016-11-30 18:29:40

volvoxturbo
Member
From: Barcelona - Frankfurt - Rome
Registered: 2012-11-12
Posts: 247
Website

Cannot login to wordpress - SOLVED

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

#2 2016-11-30 19:42:02

Ben
Moderator
From: Melbourne, Australia
Registered: 2012-09-29
Posts: 4,399

Re: Cannot login to wordpress - SOLVED

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

#3 2016-11-30 22:20:23

volvoxturbo
Member
From: Barcelona - Frankfurt - Rome
Registered: 2012-11-12
Posts: 247
Website

Re: Cannot login to wordpress - SOLVED

Thank you Ben,

you are right! I closed it with ?> and everything works fine :-)

Best regards,
Oliver

Offline

Board footer

Powered by FluxBB