This topic has 28 replies, 4 voices, and was last updated 5 years by Radu.

  • Author
  • #207140
     bassfan
    Participant

    Hi there

    At some point in the recent past, after updating my Kleo theme to the latest version I started getting this error

    Uncaught Error: Syntax error, unrecognized expression: .kleo-main-header .nav > li a[href=#fit-vids-style]

    Do you have any idea what could be causing this?  It’s causing later javascript not to execute screwing up the site.  I reverted back to a previous version that I had stored off, and its a little old.  The link I’m providing is of a staging site that is running the latest version of Kleo, and has the error.  My main site is now running 4.2.12 which doesn’t cause the error.  I see some other people have had this problem and mention it in the comments on envato so it must not just be me.  Speaking of which, is there somewhere that I can access all the previous versions of the theme from this site?

    I see this article here describing the problem but it is quite old:  https://archived.seventhqueen.com/kleo/article/wordpress-4-5-kleo-4-0-5-error

    thanks

    Daren

    #207162
     Laura
    Moderator

    Hello, will assign the ticket to a higher support level who can help and advise you in your query.
    Thanks! ?

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #207274
     bassfan
    Participant

    Hi, anything here? I’d like to get my site updated to the latest version

    #207531
     bassfan
    Participant

    I tried removing everything related to fit-vids-style from app.js and app.min.js but then it had another similar error with something else.

    #207536
     mudandroutes
    Participant

    This sounds like the same issue i’m experiencing It’s only just appeared, i can’t assign it to any update but I’m getting this error – only when logged in:

    Uncaught Error: Syntax error, unrecognized expression: .kleo-main-header .nav > li a[href=#OpenLayers.Map_10_OpenLayers_ViewPort]

    The final section of the error after href= is the only thing different, and my guess is that this is the same issue.

    I’m getting this on all my sites of sites that are running the same plugins.

    Happy to open a new ticket if needed.

    The site is – https://www.mudandroutes.com/routes/walk-from-lamlash-to-brodick/– which is one of the pages that has a “Location Map” that’s not appearing due to this error.. If I log out, then the error disappears and everything works fine.

    #207553
     bassfan
    Participant

    Definitely sounds very similar.

    Ya the problem is that the id after the # needs quotes around it i think…at least that was mentioned somewhere on stack overflow when I was looking. However, I’d just like a fix or the previous theme files available for me to get to but haven’t heard back from anyone (or Laura).

    #207609
     mudandroutes
    Participant

    Saw something on Stack Overflow but no idea from the console error in which file the error is occurring? I’d have a tinker around in there if needed, but I don’t even know which file to start with! Hopefully there’s an easy fix (there was an update in the theme today, but still the same for me).

    #207633
     Radu
    Moderator

    Hi,

    There its’a function that handles the videos iframes to full available space in htm elements, on your site @bassfan the issue seems to be triggered by the datatables file from cdn.


    @mudandroutes
    and @bassfan
    Maybe the cdn loads before the app.min.js file, did you had changed the order of the js files in page so they will load in other order than default ? using or not a plugin that optimize the speed and the page time response ?

    If you will de-activate child theme and empty all caches will be ok ?

    Cheers
    R

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #207657
     bassfan
    Participant

    Hey Radu

    I haven’t changed my child theme in months. If I activate the parent, yes the issue goes away but that’s expected given the page template does not show anything in that case. Ya I agree that it’s the datatables doing it but just can’t figure out why. There are no videos on the page though. The site isn’t using any caching plugin.

    Can I get a theme release that’s a couple back from current and try that until I can get it resolved further? Right now I’m running a release from quite a while back but it’s mismatched with visual composer and other required plugins.

    Thanks

    #207703
     bassfan
    Participant

    Well Radu I got it mostly working. Your comment about the app.min.js loading before had me trying a few different things in the js that my child loads. I finally found a combination that didn’t cause the errors along with updating datatables to the latest version. Thanks!

    #207730
     mudandroutes
    Participant

    Hi @radu – I’m getting a slightly different issue – it’s a different file that’s causing the issue – see the screen grab.

    Indeed – it is an issue in my child theme – and unfortunately it’s from one of the most essential pieces of code from functions.php for my entire site! Specifically we have a preg_replace that’s causing the problem.

    COPY CODE
    // turn any link to a gpx file to a shortcode
    function osmap_gpx_link_filter( $content ) {
    $content = preg_replace( '/\<a href="(.*?\.gpx).*?a\>/','[toolset_access role="Guest"][su_note note_color="#f7332a"]<a href="/wp-login.php">Log in</a> or <a href="https://www.mudandroutes.com/register-with-mud-and-routes/">register</a> to see the Ordnance Survey map[/su_note][/toolset_access][toolset_access role="Guest" operator="deny"][osmap gpx="$1"][/toolset_access]', $content );
    return $content;
    }
    add_filter( 'the_content', 'osmap_gpx_link_filter' );
    add_shortcode( 'map', 'osmap_generator' );
    

    This turns any link to a file ending in .gpx into a specific shortcode – not sure why this is misbehaving with the theme all of a sudden. If i comment this out, then everything works – except that this then breaks a load of my posts as this is what converts the gpx files over into a map for our readers. It’s a workaround in order to support legacy posts where different shortcodes were used to embed the files, with the direct link style the one that works best as it’s easiest.

    Any idea why the above is causing a problem?
    The remainder of my functions.php has only adsense code, a couple of custom widgets and

    Also – happy to open a new thread on this if needed as I realise I’ve jumped into this thread with my issue !

    Attachments:
    You must be logged in to view attached files.
    #207763
     Radu
    Moderator

    @mudandroutes

    I see this, this cannot be named problem of the theme right ? Sice this approach causes link tags alterations.

    As an ideea for you workaround it’s to make a callback to preg_replace function will check if the items that will be changed are on the ignore list or not : https://stackoverflow.com/questions/36349310/ignore-certain-matches-in-preg-replace

    The idea it’s to target your specific a tags maybe not all a tags if they have a specific class to can alter ony the links that should be gpx file.

    The snippet looks that it already does that… nto sure why

    You can try to add the hooks of that into a function that triggers them after_setup_theme or init

    COPY CODE
    
    function sqr_late_trigger_rand89() {
    add_filter( 'the_content', 'osmap_gpx_link_filter' );
    add_shortcode( 'map', 'osmap_generator' );
    }
    
    add_action('after_setup_theme','sqr_late_trigger_rand89');
    //add_action('wp_loaded','sqr_late_trigger_rand89');
    //add_action('init','sqr_late_trigger_rand89');
    
    

    Try with that if it’s the same try the commented ones,by leaving only one action.


    @bassfan
    great if you had solved

    Cheers
    R

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #207772
     mudandroutes
    Participant

    Thanks for looking into this @radu – the code now looks like this:

    COPY CODE
    // turn any link to a gpx file to a shortcode
    function osmap_gpx_link_filter( $content ) {
    $content = preg_replace( '/\\<a href="(.*?\\.gpx).*?a\\>/','[toolset_access role="Guest"][su_note note_color="#f7332a"]<a href="/wp-login.php">Log in</a> or <a href="https://www.mudandroutes.com/register-with-mud-and-routes/">register</a> to see the Ordnance Survey map[/su_note][/toolset_access][toolset_access role="Guest" operator="deny"][osmap gpx="$1"][/toolset_access]', $content );
    return $content;
    }
    function sqr_late_trigger_rand89() {
    add_filter( 'the_content', 'osmap_gpx_link_filter' );
    add_shortcode( 'map', 'osmap_generator' );
    }
    
    //add_action('after_setup_theme','sqr_late_trigger_rand89');
    //add_action('wp_loaded','sqr_late_trigger_rand89');
    add_action('init','sqr_late_trigger_rand89');
    

    Which is hopefully correct (someone else actually did the code – i added the extra shortcodes – i’m able to modify and add snippets but that’s about the limit of my PHP).

    Unfortunately, this still brings the same error. I tried each add_action in turn uncommented, cleared the site cache completely and opened a few posts to see if this solved it.

    #207776
     Radu
    Moderator

    Hi,
    Let me know
    Cheers
    R

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #207780
     mudandroutes
    Participant

    Hi @radu – i can confirm that i still have the problem 🙁

    #207849
     Radu
    Moderator

    Hi,

    Thinking at many options but no one fit on your case.. i think the resolution it’s to speak the the developer of the code and to find a better way to do that.

    As an idea, you can parse first the all content, then to save get the links that need to be converted into the gpx file in a custom field and then to re-filter the content to show the content without links and then for logged in users to insert that custom field in content(in your shortcode) where you need.

    So in other words there the entire logic of your functions should be changed… to can not alter any other links than needed…. hope you understand

    Cheers
    R

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #207925
     mudandroutes
    Participant

    Thanks for your help @radu – I’ve tried a few more things and it seems that it’s definitely an issue with the plugin rather than the code I’m using in functions.php. I tried it with the regular Kleo theme instead of the child theme as i have a couple of customised widget areas – but still getting the issue.

    I’ll play with a few more settings, but i don’t think they’ll make any difference – so i’m going to ask the plugin developer to take a look as i’m getting the same error when all my custom code is commented out.

    #207926
     mudandroutes
    Participant

    Though just to add – the plugin works when i’m running under 2015 theme and the error is gone…

    #207975
     Radu
    Moderator

    Hi,
    I see, that maybe because the kleo uses significant more resources and scripts that default one.

    At this moment i had forwarded a new question to the core developer for new hints, until then please try to set a higher priority of that filter..just right now i had noticed that in that fiter it’s missing the accepted args at the filter…..

    COPY CODE
    
    / turn any link to a gpx file to a shortcode
    function osmap_gpx_link_filter( $content ) {
        $content = preg_replace( '/\\<a href="(.*?\\.gpx).*?a\\>/','[toolset_access role="Guest"][su_note note_color="#f7332a"]<a href="/wp-login.php">Log in</a> or <a href="https://www.mudandroutes.com/register-with-mud-and-routes/">register</a> to see the Ordnance Survey map[/su_note][/toolset_access][toolset_access role="Guest" operator="deny"][osmap gpx="$1"][/toolset_access]', $content );
        return $content;
    }
    add_filter( 'the_content', 'osmap_gpx_link_filter',10, 1 );
    
    

    The latest represents the accepted args…. so that may be a reason…. 10, represents the priority, if it’s the same increase it to 200

    From where you had get the code was a mistake since any filter should have accepted args from what i know…

    Let me know
    Cheers
    R

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #208027
     mudandroutes
    Participant

    Hi @radu – thanks for that.

    The issue is still there – and i think the code in my functions.php isn’t causing the problems. It’s definitely an issue between the theme and the following plugin – https://wordpress.org/plugins/os-openspace-maps/

    I thought it was the code above causing the issue – but even with the code commented out and the proper plugin shortcode used then i’m still getting the error.

    #208073
     Radu
    Moderator

    Hi,

    I see, i taught the same since you had tell me if you comm the code the issue goes away.

    Tried right now to reproduce the issue on my local end to can debug further but from some reason i receive this

    What php version are you running ? I’m on v7.1.8

    Looking again to your website at console

    There are 500 error for admin-ajax.php and next another js error, looking in page source code, ic annot see the OS OpenSpace Maps plugin activated…

    For the internal server error you will have to enable wp debug to can see what’s exactly the cause…

    Steps to enable wp debug:

    •  Connect to your server by FTP
    • Look in root directory of your WordPress install and open wp-config.php
    • Search for define( ‘WP_DEBUG’, false ); and change FALSE value to TRUE
    COPY CODE
    define( 'WP_DEBUG', true );
    
    •   After this line add this:
    COPY CODE
    define( 'WP_DEBUG_LOG', true );
    

    WP_DEBUG_LOG is a companion to WP_DEBUG that causes all errors to also be saved to a debug.log log file inside the /wp-content/ directory. This is useful if you want to review all notices later or need to view notices generated off-screen (e.g. during an AJAX request or wp-cron run).

    Repeat the described actions and then check the debug.log file and let me know what error appears.

    If this is useless please try to deactivate additional plugins except Visual Composer, K-elements, BuddyPress, Paid memberships pro and revolution slider.

    After you have disabled the plugins try to see if the error persists.

    Where the map appears on your website (provide URL)

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #208081
     mudandroutes
    Participant

    hi @radu – i think you’re looking at a diffrent website to mine -i think i sorta hijacked this thread half way through, sorry!
    One of the sites – which is easiest for me to disable plugins on as the traffic isn’t important at the moment is this site:

    https://www.walkingthewesthighlandway.co.uk/routes/west-highland-way-section-6-bridge-orchy-kings-house/

    I have a plugin in place that limits the rendering of some of the maps (the OS Openspace plugin) as we quickly reach the daily limit with the free API – so you cannot see the maps without loggin in.

    For the site above with the issue – screnshot 53
    and when i disable OS Openspace plugin then see screnshot 54 – everything now works…

    Hopefully that makes sense? I’ve re-enabled the plugin on the link provided above so you should see the error in console.

    I’ll enable WP_Debug if needed.

    Thanks

    Attachments:
    You must be logged in to view attached files.
    #208317
     Radu
    Moderator

    Hi,

    YEs i fully understand wanted to see the maps with the error and to check in admin something settings for the plugin.

    At this moment visiting your provided link https://www.walkingthewesthighlandway.co.uk/routes/west-highland-way-section-6-bridge-orchy-kings-house/ there are trow some js error without seeing the map frmo that plugin. So at this moment plugin script it’s not initialized and map not shown right ?

    Let me know the admin credentials to test personally the behaviour, on my local end i cannot see the plugin dashboard says no allowed…

    Cheers
    R

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #208390
     mudandroutes
    Participant
    This reply has been set as private.
    #208559
     Radu
    Moderator

    Hi,

    The login it’s incorrect for both the the websites…

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #208627
     mudandroutes
    Participant
    This reply has been set as private.
    #208679
     Radu
    Moderator

    Hi,

    Please replace this file content : wp-content/themes/kleo/assets/js/app.js

    With the content of this one : https://pastebin.com/raw/PHCTKwWb

    Also replace the app.min.js file : wp-content/themes/kleo/assets/js/app.min.js
    with this conten : https://pastebin.com/raw/9v9iWT4F

    Make sure to empty all caches.

    Let me know if the js error still happens, it should not.

    Cheers
    R

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #208766
     mudandroutes
    Participant

    Thank you very much Radu!
    Works perfectly!
    Can you please confirm if this will appear in a future update or do i need to keep these now updated files in the child theme?

    #208817
     Radu
    Moderator

    Hi,

    The fix will be included in the theme update.

    Cheers
    R

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 29 posts - 1 through 29 (of 29 total)

The forum ‘Bugs & Issues’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?