Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #367206

    BaristaFair
    Participant

    Hi,
    I have a big problem.
    When I change and update a page (front page) almost everything disappears in the editor/VC. Only the two content band on the top is left. If I go back a version it all comes back.
    /m

    #367208

    Lely
    Moderator

    Hello There,

    Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    #367212

    BaristaFair
    Participant
    This reply has been marked as private.
    #367213

    BaristaFair
    Participant
    This reply has been marked as private.
    #367225

    Lely
    Moderator

    Hello There,

    Thank you for the admin credentials.
    Upon checking, you have javascript error. When adding script via Appearance > Customize > Custom >Javascript <script></script> tag is no longer required. Please delete it.

    Would you mind updating and saving the frontpage? This is just so we can check what happened and why other content was missing? You can go back again to a working version after checking.

    Thank you.

    #367228

    BaristaFair
    Participant

    Yes. Done. And the <script></script> via Appearance > Customize > Custom >Javascript is gone.

    #367232

    Paul R
    Moderator

    Hi,

    Did removing it resolve your issue?

    I’d like to check but I am getting this message when trying to edit the page.

    http://screencast.com/t/41jB1PiAF8

    You could also try testing for a plugin conflict. You can do this by deactivating all third party plugins, and seeing if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.

    Thanks

    #367239

    BaristaFair
    Participant

    No.
    Sorry, you can check now.
    There is another script on page. But it all worked before the new WP update.

    #367259

    Paul R
    Moderator

    Hi,

    Please add your javascript code in your child theme instead of adding it in a raw javascript element.

    You may refer to the link below for your guide on how to set-up a child theme

    https://community.theme.co//kb/how-to-setup-child-themes/

    After that, you can remove the script from your page and add the code below in your child theme’s functions.php file

    
    function my_custom_footer_output() {
      ?>
    
    <script src="http://cloudex.barista.se/BaristaLoyaltyWeb/Scripts/jquery.signalR-2.0.0.min.js"></script>
         <script type="text/javascript">
    
            /*!
             * ASP.NET SignalR JavaScript Library v2.0.0
             * http://signalr.net/
             *
             * Copyright Microsoft Open Technologies, Inc. All rights reserved.
             * Licensed under the Apache 2.0
             * https://github.com/SignalR/SignalR/blob/master/LICENSE.md
             *
             */
    
            /// <reference path="..\..\SignalR.Client.JS\Scripts\jquery-1.6.4.js" />
            /// <reference path="jquery.signalR.js" />
            (function ($, window, undefined) {
                /// <param name="$" type="jQuery" />
                "use strict";
    
                if (typeof ($.signalR) !== "function") {
                    throw new Error("SignalR: SignalR is not loaded. Please ensure jquery.signalR-x.js is referenced before ~/signalr/js.");
                }
    
                var signalR = $.signalR;
    
                function makeProxyCallback(hub, callback) {
                    return function () {
                        // Call the client hub method
                        callback.apply(hub, $.makeArray(arguments));
                    };
                }
    
                function registerHubProxies(instance, shouldSubscribe) {
                    var key, hub, memberKey, memberValue, subscriptionMethod;
    
                    for (key in instance) {
                        if (instance.hasOwnProperty(key)) {
                            hub = instance[key];
    
                            if (!(hub.hubName)) {
                                // Not a client hub
                                continue;
                            }
    
                            if (shouldSubscribe) {
                                // We want to subscribe to the hub events
                                subscriptionMethod = hub.on;
                            } else {
                                // We want to unsubscribe from the hub events
                                subscriptionMethod = hub.off;
                            }
    
                            // Loop through all members on the hub and find client hub functions to subscribe/unsubscribe
                            for (memberKey in hub.client) {
                                if (hub.client.hasOwnProperty(memberKey)) {
                                    memberValue = hub.client[memberKey];
    
                                    if (!$.isFunction(memberValue)) {
                                        // Not a client hub function
                                        continue;
                                    }
    
                                    subscriptionMethod.call(hub, memberKey, makeProxyCallback(hub, memberValue));
                                }
                            }
                        }
                    }
                }
    
                $.hubConnection.prototype.createHubProxies = function () {
                    var proxies = {};
                    this.starting(function () {
                        // Register the hub proxies as subscribed
                        // (instance, shouldSubscribe)
                        registerHubProxies(proxies, true);
    
                        this._registerSubscribedHubs();
                    }).disconnected(function () {
                        // Unsubscribe all hub proxies when we "disconnect".  This is to ensure that we do not re-add functional call backs.
                        // (instance, shouldSubscribe)
                        registerHubProxies(proxies, false);
                    });
    
                    proxies.fairTradeHub = this.createHubProxy('fairTradeHub');
                    proxies.fairTradeHub.client = {};
                    proxies.fairTradeHub.server = {
                        registerTerminal: function (terminalId) {
                            return proxies.fairTradeHub.invoke.apply(proxies.fairTradeHub, $.merge(["RegisterTerminal"], $.makeArray(arguments)));
                        },
    
                        sendToAll: function (name, message) {
                            return proxies.fairTradeHub.invoke.apply(proxies.fairTradeHub, $.merge(["SendToAll"], $.makeArray(arguments)));
                        }
                    };
    
                    return proxies;
                };
    
                signalR.hub = $.hubConnection("http://cloudex.barista.se/BaristaLoyaltyWeb/signalr", { useDefaultPath: false });
                //signalR.hub = $.hubConnection("http://192.168.1.241:81/signalr", { useDefaultPath: false });
                $.extend(signalR, signalR.hub.createHubProxies());
    
            }(window.jQuery, window));
    
            (function ($) {
    
                $.ajax({
                    type: "GET",
                    dataType: "json",
                    url: "http://cloudex.barista.se/BaristaLoyaltyWeb/FairTrade.svc/getcontribution",
                    success: function (data) {
                     
                        var contribution = eval(data.d);
    
                        $('#numberOfMeals').html(contribution.MealsSinceStart);
                        $('#numberOfChildrens').html(contribution.ChildrenInSchool);
                        $('#shopDesc').html(contribution.LastPurchaseStore);
    
                        $("#ContributionInfo").show();
                    }
                })
            }(window.jQuery, window));
    
           
            (function ($) {
    
                // Declare a proxy to reference the hub. 
                var fairTradeHub = $.connection.fairTradeHub;
    
                //alert($.connection.hub.url);
               // $.connection.hub.url = "http://192.168.1.241:81/signalr";
    
                // Create a function that the hub can call to broadcast stats.  numberofmeals, numberofchildren
                fairTradeHub.client.broadcastStats = function (numberofmeals, numberofchildren, shopDesc) {
                    // Html encode display name and message. 
                    var noOfChildren = $('<div />').text(numberofchildren).html();
                    var noOfMealsEncoded = $('<div />').text(numberofmeals).html();
                    var shopDescEncoded = $('<div />').text(shopDesc).html();
    
                    // Add the message to the page. 
                    $('#numberOfMeals').html(noOfMealsEncoded);
                    $('#numberOfChildrens').html(noOfChildren);
                    $("#shopDesc").hide();
                    $('#shopDesc').html(shopDescEncoded);
                    $("#shopDesc").fadeIn(2000);
                    //$("#shopDesc").fadeOut(6000)
                };
    
                var tryingToReconnect = false;
    
                $.connection.hub.reconnecting(function () {
                    tryingToReconnect = true;
                });
    
                $.connection.hub.reconnected(function () {
                    tryingToReconnect = false;
                });
    
                $.connection.hub.disconnected(function () {
                    if (tryingToReconnect) {
                        notifyUserOfDisconnect(); // Your function to notify user.
                    }
    
                    setTimeout(function () {
                        $.connection.hub.start();
                    }, 5000); // Restart connection after 5 seconds.
                });
    
                $.connection.hub.start().done(function () {
    
                });
            })(jQuery);
    
            function notifyUserOfDisconnect() {
                //alert('Terminal frånkopplad');
            }
        </script>
      <?php
    }
    
    add_action( 'wp_footer', 'my_custom_footer_output', 99999 );
    

    Hope that helps.

    #384215

    BaristaFair
    Participant

    FYI
    The new update solved the problem.
    Thanks! Yay!

    #384229

    Rue Nel
    Moderator

    Hey There,

    We are glad that the new update resolve the issue.
    Thanks for letting us know!

    Cheers.