Forum Replies Created

Viewing 15 replies - 1 through 15 (of 18 total)
  • Thread Starter HenshawAC

    (@donaldsonac)

    I tried this, deactivate, delete, then re-install that same Code Embed plugin.

    Also, changed %CODE1% to {{CODE1}} in case that made any difference, but without success, still the grey box instead of the interactive map on my page https://britishcounties.org/wikishire-map/

    The script set in Value seems very long and I am wondering if it’s needed and if it’s actually correct, maybe something changed on the source website?

    Sorry to be a thicko and be completely out of my depth (I am under pressure from the members of the campaign to try and fix this), using the Code Embed plugin, what Value should %CODE1% be in order to achieve this interactive map but on our campaign page please? https://wikishire.co.uk/map

    Originally I looked at the page source and simply copied that to the Value field, and I was amazed it actually worked, but I have no idea what might have changed to cause it to stop working on our page, but the source website is working fine.

    Thanks for any help or advice.

    Andrew.

    Thread Starter HenshawAC

    (@donaldsonac)

    Thanks for your reply. This was originally implemented by using a plugin “Code Embed” by David Artiss.

    🧩 Code Embed provides a very easy and efficient way to embed code (JavaScript and HTML) in your posts and pages.

    This is the description, and it’s the only plugin listed with that jigsaw icon thing, so I am not sure if it’s just part of the description, or it means something.

    It’s in the settings of this plugin where %CODE1% is specified with the Value.

    If this is plugin is perhaps the source of the problem, could you please recommend another plugin I could install and try instead of this one?

    Thread Starter HenshawAC

    (@donaldsonac)

    Thank you both for your replies. All the plugins and widgets are active and updated.

    After regression therapy I managed to find Custom Fields relating to the Wikishire Map page on my site, I had to enable the show custom fields toggle, deep in the settings.

    CODE1 has this value:

    <style>
    #map  {
    position: relative;
    width:  100%;
    height: 600px;
    background-color: gray;
    z-index: 0;
    }
    
    div#input {
    position: absolute;
    left: 4em; top: 1em; z-index: 1; background-color: #ccc; border: 1px solid #888;
    vertical-align: center; border-radius: 4px;
    }
    div#input input {
    font-size: 12pt;
    }
    
    input[type=text] {
    width: 14em; margin-left: 4px; margin-top: 2px; margin-bottom: 2px; padding: 2px;
    }
    
    div#results {
    visibility: hidden;
    position: absolute;
    opacity: 0.9;
    top: 5em; left: 5em; width: 30em; z-index: 2;
    background-color: #eee;
    text-color: #444;
    font-family: sans-serif;
    font-size: 10pt;
    padding: 1em;
    overflow: auto;
    }
    
    div#prev, div#next {
    float: right;
    }
    
    img.closebutton {
    float: right; width: 17px; right: 17px;
    }
    
    </style>
    <script src="https://wikishire.co.uk/map/inset"></script>
    <div id="input">
    <form action="javascript:void(0);" onsubmit="check(); return false;">
    <input type="text" id="q" size="26" placeholder="Place, county or postcode" />
    <input type="submit" value="OK" />
    </form>
    </div>
    <div id="map"></div>
    <div id="results">
    </div>
    <script type="text/javascript">
    
    if (window.addEventListener) window.addEventListener("load", search_init, false);
    else if (window.attachEvent) window.attachEvent("onload", search_init);
    
    var WGS84 = new OpenLayers.Projection("EPSG:4326");
    var mercator = new OpenLayers.Projection("EPSG:900913");
    var popup_visible = results_visible = check_waiting = false;
    var gazsearch = "";
    
    function search_init()
    {
      markers = new OpenLayers.Layer.Markers("markers");
      map_map.addLayer(markers);
      querybox = document.getElementById("q");
      results = document.getElementById("results");
    }
    // Check contents of query box
    
    function check()
    {
      if (check_waiting) return;
      if (popup_visible) close_cloud();
      if (results_visible) close_results();
      if (querybox.value == "") return;
    
      check_waiting = true;
    
      var r = new XMLHttpRequest();
      query = querybox.value;
    
      if (ispostcode(query)) {
    
        // Dealing with postcode input
    
        pc = query.replace(/ /g, "").toUpperCase();
        if (pc.length >= 5 && pc.length <= 7) {
          oc = pc.substring(0, pc.length-3);
          ic = pc.substring(pc.length-3);
          querybox.value = query = oc+" "+ic;
        } else {
    
          // Just a postcode district
    
          oc = pc;
          ic = "";
          querybox.value = query = pc;
        }
        
        // Are we looking at a detached layer?
    
        if (map_type.indexOf("detached") == -1) r.open("GET", "https://wikishire.co.uk/map/lookup?q="+oc+ic, true);
        else r.open("GET", "https://wikishire.co.uk/map/lookup?q="+oc+ic+"&hcs=B", true);
    
        r.onreadystatechange = function() { process_point(r, query); }
        r.send(null);
      } else if (iscoords(query)) {
    
        // Dealing with comma-separated co-ordinates
    
        querybox.disabled = "disabled";
        coords = query.replace(/ /g, "");
        var c = coords.split(",");
        var loc = new OpenLayers.LonLat(c[1], c[0]).transform(WGS84, mercator);
        map_map.moveTo(loc, 7);
        query = querybox.value = coords;
    
        // Are we looking at a detached layer?
    
        if (map_type.indexOf("detached") == -1) r.open("GET", "https://wikishire.co.uk/map/lookup?q="+coords, true);
        else r.open("GET", "https://wikishire.co.uk/map/lookup?q="+coords+"&hcs=B", true);
    
        r.onreadystatechange = function() { process_point(r, coords); }
        r.send(null);
    
      } else if (iscounty(query)) {
    
        // Dealing with direct county name input
    
        county = query.replace(/^ */g, "");
        r.open("GET", "https://wikishire.co.uk/map/data?q="+county, true);
        r.onreadystatechange = function() { process_data(r); }
        r.send(null);
    
      } else {
    
        // Everything else is a Gazetteer search
    
        if (query == gazsearch) {
          results.style.visibility = "visible";
          results.style.opacity = "0.9;";
          results_visible = true;
          check_waiting = false;
          querybox.blur();
        } else {
          gazsearch = query;
          r.open("GET", "https://wikishire.co.uk/map/gazetteer?q="+gazsearch, true);
          r.onreadystatechange = function() { process_gaz(r); }
          r.send(null);
        }
      }
    }
    
    // Handle CSV point result from postcode or co-ord lookup
    
    function process_point(r, label)
    {
      if (r.readyState != 4) return;
      querybox.disabled = "";
      if ((r.status != 200) || (r.responseText == "invalid\n")) {
        check_waiting = false;
        return;
      }
    
      check_waiting = false;
      var c = r.responseText.split(";");
      var county = c[0];
      var loc = new OpenLayers.LonLat(c[2], c[1]).transform(WGS84, mercator);
    
      map_map.setCenter(loc);
      open_cloud(loc, label+"<br /><b>"+county+"</b>");
      querybox.value = label;
    }
    
    // Process CSV data from county lookup
    
    function process_data(r)
    {
      if (r.readyState != 4) return;
      if ((r.status != 200) || (r.responseText == "invalid\n")) {
        check_waiting = false;
        return;
      }
    
      var data = r.responseText.split(";");
      var county = data[0];
      var area = parseInt(data[1]).toLocaleString();
      var area_det = parseInt(data[2]).toLocaleString();
      var pop = parseInt(data[3]).toLocaleString();
      var centre = data[4].split(",");
      var zoom = data[5].split(",");
      var zoombounds = new OpenLayers.Bounds(zoom).transform(WGS84, mercator);
      var loc = new OpenLayers.LonLat(centre).transform(WGS84, mercator);
    
      // If we are looking at a detached layer, then show detached area
    
      if (map_type.indexOf("detached") != -1) area = area_det;
      var data = "<b><a href=\"https://wikishire.co.uk/wiki/"+county+"\">"+county+"</a></b><br />Area: "+area+" sq mi.";
    
      if (pop != 0) data += "<br />Population: "+pop;
    
      map_map.zoomToExtent(zoombounds);
      open_cloud(loc, data);
      querybox.value = county;
      check_waiting = false;
    }
    
    // Process JSON resuls from Gazetteer lookup
    
    function process_gaz(r)
    {
      if (r.readyState != 4) return;
      if (r.status != 200) return;
    
      data = JSON.parse(r.responseText);
      if (data.head.totalResults == 0) {
        check_waiting = false;
        results.innerHTML = "<div style=\"float: left\"><b>No results</b> for <i>'"+data.head.searchTerms+"'</i></div><img class=\"closebutton\" src=\"https://wikishire.co.uk/map/img/close.gif\" onclick=\"close_results()\">\n";
        results.style.visibility = "visible";
        results.style.opacity = "0.9";
        results_visible = true;
        return;
      }
      querybox.value = data.head.searchTerms;
    
      if (data.head.totalResults > 1) {
        check_waiting = false;
        querybox.blur();
    
        var start = data.head.startIndex;
        var total = data.head.totalResults;
        var page = total-start > 10 ? 10 : total-start;
        var html = "<div style=\"float: left\"><b>Results "+(start+1)+"&ndash;";
    
        html += (start+page)+" of "+total+"</b></div><img class=\"closebutton\" src=\"https://wikishire.co.uk/map/img/close.gif\" onclick=\"close_results()\">\n";
        if (start+page < total) html += "<div id=\"next\"><button type=\"button\" onclick=\"next("+(start+10)+")\">Next</button></div>\n";
        if (start > 0) html += "<div id=\"prev\"><button type=\"button\" onclick=\"next("+(start-10)+")\">Previous</button></div>\n";
        html += "<table style=\"clear: both\">\n<tr><th>Place</th><th>County</th><th>Co-ords</th>\n";
    
        for(var i = 0; i < page; i++) {
          var label = data.results[i].label;
          var type = data.results[i].type;
          var county = data.results[i].county;
          var easting = data.results[i].easting;
          var northing = data.results[i].northing;
          var lat = data.results[i].latitude;
          var lon = data.results[i].longitude;
          html += "<tr><td><a href=\"javascript:void(0)\" onclick=\"pin('"+escape(label)+"','"+type+"','"+county+"',"+lat+","+lon+")\" title=\""+get_type(type)+"\">"+label+"</a></td><td>"+county+"<td>"+lat+","+lon+"</td></tr>\n";
        }
        results.innerHTML = html+"</table>\n";
        results.style.visibility = "visible";
        querybox.blur();
        results_visible = true;
        return;
      }
    
      if (data.head.totalResults == 1) {
        querybox.value = data.results[0].label;
        pin(data.results[0].label, data.results[0].type, data.results[0].county, data.results[0].latitude, data.results[0].longitude);
      }
    }
    
    // Request a new block of Gazetteer results
    
    function next(offset)
    {
      var r = new XMLHttpRequest();
      var url = "https://wikishire.co.uk/map/gazetteer?q="+gazsearch;
    
      if (offset != 0) url += "&o="+offset;
      r.open("GET", url, true);
      r.onreadystatechange = function() { process_gaz(r); }
      r.send(null);
    }
    
    // Place a pin from a gazetteer search result
    
    function pin(label, type, county, lat, lon)
    {
      var loc = new OpenLayers.LonLat(lon, lat).transform(WGS84, mercator);
    
      close_results();
      map_map.setCenter(loc);
      var html = unescape(label);
      var type = get_type(type);
      if (type != "place") html += " <small>("+type+")</small>";
      if (county != "None") html += "<br /><b>"+county+"</b>";
      open_cloud(loc, html);
      check_waiting = false;
    }
    
    // Convert Gazetteer result code into text
    
    function get_type(type)
    {
      switch(type) {
        case 'C': type = "City"; break;
        case 'T': type = "Town"; break;
        case 'O': type = "village"; break;
        case 'W': type = "water"; break;
        case 'H': type = "hill"; break;
        case 'R': type = "roman antiquity"; break;
        case 'F': type = "wood"; break;
        case 'FM': type = "farm"; break;
        case 'NT': type = "National Trust"; break;
        default: type = "place";
      }
      return type;
    }
    
    // Open a pop-up cloud
    
    function open_cloud(loc, text)
    {
      point = new OpenLayers.Marker(loc);
      cloud = new OpenLayers.Popup.FramedCloud("cloud", loc, null, text, null, true, close_cloud);
      markers.addMarker(point);
      map_map.addPopup(cloud);
      popup_visible = true;
    }
    
    // Close the cloud
    
    function close_cloud()
    {
      markers.removeMarker(point);
      map_map.removePopup(cloud);
      point.destroy();
      cloud.destroy();
      popup_visible = false;
    }
    
    // Close results box
    
    function close_results()
    {
      results.style.opacity = "0;";
      results.style.visibility = "hidden";
      results_visible = false;
    }
    
    // Query is a postcode or alphanumeric grid reference
    
    function ispostcode(q)
    {
      if (q.search(/[A-Z]+ *[0-9]+/i) != -1) return true;
      return false;
    }
    
    function iscoords(q)
    {
      if (q.search(/[^0-9\.\-,]/)) return true;
      return false;
    }
    
    function iscounty(q)
    {
      c = q.replace(/^ */g, "").toLowerCase().replace(/ +/g, " ").replace(".", "");
      c = c.replace("county of ", "");
      switch(c) {
        case "aberdeenshire": 
        case "anglesey": 
        case "angus": 
        case "forfarshire": 
        case "forfars": 
        case "county antrim": 
        case "argyllshire": 
        case "argyll": 
        case "county armagh": 
        case "ayrshire": 
        case "banffshire": 
        case "bedfordshire": 
        case "berkshire": 
        case "berks": 
        case "berwickshire": 
        case "berwicks": 
        case "breconshire": 
        case "brecknockshire": 
        case "brecons": 
        case "buckinghamshire": 
        case "bucks": 
        case "buteshire": 
        case "bute": 
        case "caernarfonshire": 
        case "caernarfons": 
        case "caithness": 
        case "cambridgeshire": 
        case "cambs": 
        case "cardiganshire": 
        case "cards": 
        case "carmarthenshire": 
        case "carms": 
        case "cheshire": 
        case "ches": 
        case "clackmannanshire": 
        case "clacks": 
        case "cornwall": 
        case "cromartyshire": 
        case "cumberland": 
        case "denbighshire": 
        case "denbighs": 
        case "derbyshire": 
        case "derbys": 
        case "devon": 
        case "devonshire": 
        case "dorset": 
        case "dorsetshire": 
        case "downshire": 
        case "county down": 
        case "down": 
        case "dumfriesshire": 
        case "dunbartonshire": 
        case "dunbartons": 
        case "county durham": 
        case "east lothian": 
        case "haddingtonshire": 
        case "haddingtons": 
        case "essex": 
        case "fermanagh": 
        case "county fermanagh": 
        case "fife": 
        case "fifeshire": 
        case "flintshire": 
        case "flints": 
        case "glamorgan": 
        case "glamorganshire": 
        case "glam": 
        case "gloucestershire": 
        case "glos": 
        case "hampshire": 
        case "hants": 
        case "herefordshire": 
        case "herefords": 
        case "hertfordshire": 
        case "herts": 
        case "huntingdonshire": 
        case "hunts": 
        case "invernesshire": 
        case "invernessshire": 
        case "inverness-shire": 
        case "kent": 
        case "kincardineshire": 
        case "kincardines": 
        case "king's county": 
        case "kinrosshire": 
        case "kinrossshire": 
        case "kinross-shire": 
        case "kirkcudbrightshire": 
        case "lanarkshire": 
        case "lanarks": 
        case "lancashire": 
        case "lancs": 
        case "leicestershire": 
        case "leics": 
        case "lincolnshire": 
        case "lincs": 
        case "county derry": 
        case "county londonderry": 
        case "merionethshire": 
        case "merioneth": 
        case "middlesex": 
        case "midlothian": 
        case "edingurghshire": 
        case "edingurghs": 
        case "monmouthshire": 
        case "mon": 
        case "montgomeryshire": 
        case "monts": 
        case "morayshire": 
        case "moray": 
        case "elginshire": 
        case "nairnshire": 
        case "norfolk": 
        case "northamptonshire": 
        case "northants": 
        case "northumberland": 
        case "nottinghamshire": 
        case "notts": 
        case "orkney": 
        case "oxfordshire": 
        case "oxon": 
        case "peeblesshire": 
        case "pembrokeshire": 
        case "pembs": 
        case "perthshire": 
        case "perths": 
        case "queen's county": 
        case "radnorshire": 
        case "radnors": 
        case "renfrewshire": 
        case "renfrews": 
        case "rosshire": 
        case "rossshire": 
        case "ross-shire": 
        case "roxburghshire": 
        case "roxburghs": 
        case "rutland": 
        case "selkirkshire": 
        case "selkirks": 
        case "shetland": 
        case "shropshire": 
        case "salop": 
        case "somerset": 
        case "somersetshire": 
        case "som": 
        case "staffordshire": 
        case "staffs": 
        case "stirlingshire": 
        case "stirlings": 
        case "suffolk": 
        case "surrey": 
        case "sussex": 
        case "sutherland": 
        case "tyrone": 
        case "warwickshire": 
        case "warks": 
        case "west lothian": 
        case "linlithgowshire": 
        case "linlithgows": 
        case "westmorland": 
        case "wigtownshire": 
        case "wigtowns": 
        case "wiltshire": 
        case "wilts": 
        case "worcestershire": 
        case "worcs": 
        case "yorkshire": 
        case "yorks": 
        case "yorkshire, east riding": 
        case "yorkshire, north riding": 
        case "yorkshire, west riding": 
        case "east riding of yorkshire": 
        case "north riding of yorkshire": 
        case "west riding of yorkshire": 
        case "east riding": 
        case "north riding": 
        case "west riding": 
        case "lindsey": 
        case "kesteven": 
        case "parts of lindsey": 
        case "parts of kesteven": 
        case "parts of holland": 
        case "lincolnshire, parts of lindsey": 
        case "lincolnshire, parts of kesteven": 
        case "lincolnshire, parts of holland": 
        case "county carlow":
        case "county cavan":
        case "county county clare":
        case "county cork":
        case "county donegal":
        case "county dublin":
        case "county galway":
        case "county kerry":
        case "county kildare":
        case "county kilkenny":
        case "county laois":
        case "county leitrim":
        case "county limerick":
        case "county longford":
        case "county louth":
        case "county mayo":
        case "county meath":
        case "meath":
        case "county monaghan":
        case "county offaly":
        case "county roscommon":
        case "county sligo":
        case "county tipperary":
        case "county waterford":
        case "county westmeath":
        case "westmeath":
        case "county wexford":
        case "county wicklow ":
          return true;
        default: return false;
      }
    }
    
    </script>

    As I previously mentioned, I managed to create my page to show the interactive map by pointing it to https://wikishire.co.uk/map – I obtained the script (if that’s the right word) by clicking on Inspect and using the information there, somehow it worked, but recently something changed and so my page just shows the grey box.

    I looked again at the Source of https://wikishire.co.uk/map but I can’t find anything that exactly matches the Value I previously added in Custom Field.

    I am completely out of my depth it seems. If you could possibly help me work out what’s gone wrong, and what can be done to get this working again I would be eternally grateful.

    Thank you for any help offered.

    Andrew.

    Thread Starter HenshawAC

    (@donaldsonac)

    Hi George,
    Thank you for your reply, it’s much appreciated.
    I solved the problem, quite by chance, the Row Settings/Style changed from Default to Full Height, and when I tested it works perfectly now on web and mobile browser.

    Thank you and kind regards,

    Andrew.

    Thread Starter HenshawAC

    (@donaldsonac)

    Update: After all night I managed to get the pages live by using SoundCloud to host the audio and I pasted the embedded HTML code to my page, this isn’t the best option as the interview as used most of the SoundCloud allocation of 3 hours.

    If anyone can help get the WP built in audio player to work I’d be eternally grateful.

    Thanks and regards,

    Andrew.

    Thread Starter HenshawAC

    (@donaldsonac)

    Hi James,

    Oh, maybe that’s why.

    I tried to add to upload to the site, the file is 130MB so I had to add userphp.ini file to cPanel to allow larger files, I used these parameters:

    upload_max_filesize = 512M
    memory_limit = 512M
    max_execution_time 180
    post_max_size = 512M
    max_input_time = 180

    Now I see max file size to upload had increased from 128MB to 512MB.

    I got HTTP error, so after Googling and trying various things I did this:

    Deactivated all plugins.

    wp-config.php > added define( ‘WP_MEMORY_LIMIT’, ‘256M’ );

    Updated PHP to Version 7.3

    In cPanel, I added to wp-content>themes>shoreditch>functions.php this code to force GD library:

    function wpb_image_editor_default_to_gd( $editors ) {
    $gd_editor = ‘WP_Image_Editor_GD’;
    $editors = array_diff( $editors, array( $gd_editor ) );
    array_unshift( $editors, $gd_editor );
    return $editors;
    }
    add_filter( ‘wp_image_editors’, ‘wpb_image_editor_default_to_gd’ );

    After this when I drag and drop or select the audio file it loads up 100% then gives the http error again.

    What on earth can be wrong with it? Any help or advice greatly appreciated!

    Thanks and regards,

    Andrew.

    Thread Starter HenshawAC

    (@donaldsonac)

    Sorry about that, how can I delete this one? I can’t find how to delete this post.

    Andrew.

    Thread Starter HenshawAC

    (@donaldsonac)

    I worked out how to do it: Settings in Dashboard, Blog pages show at most – 5. Change this to 100.

    Thanks you.

    Andrew.

    Thread Starter HenshawAC

    (@donaldsonac)

    OK, thank you, this sounds a bit involved, I will have a play around and try your suggestions.

    Andrew.

    Thread Starter HenshawAC

    (@donaldsonac)

    Thanks for your reply, yes it was OK in the end, I cleared the cache and it was fine!

    Andrew.

    Thread Starter HenshawAC

    (@donaldsonac)

    Hi, Customise>Content Options is set to show excerpts.

    This changed the comments and names to blue, lovely.

    When I create a new post it automatically adds the … Continue reading to the excerpt on the News page, when that is licked it opens up fully on a new page.

    I can’t find anywhere how to change that … Continue reading to Read More>> like on the Recent Posts with thumbnails Top Footer Widget.

    I tried setting Posts to Full Post then edited to manually add the MORE break, but it still says continue.

    Any idea how to change the word “continue” to “Read More>>”

    And last question, I promise (!), on the Blog posts page, is there a way to show the first image of the post as a thumbnail on the news page when it’s set to excerpts?

    Thank you, Andrew.

    Thread Starter HenshawAC

    (@donaldsonac)

    Aw thank you that’s great!

    Yes I installed WP Beaver Builder page builder some posts would appear as I needed them.

    I noticed the comments don’t appear in the same colour, would they need a specific command to change their colour too?

    Sorry to bug but can I ask if you know where I can change the “Continue Reading” link to something else such as “More>>” and maybe even add thumbnails for the page
    https://britishcounties.org/news/

    Thank you for your help and advice. it’s been an absolute life saver over since I had do do this page for the campaign!

    Andrew.

    Thread Starter HenshawAC

    (@donaldsonac)

    That worked a treat! I set it to 1.5rem and found by removing “.single” it applied it to the main News page too (the page showing just the excerpts):

    https://britishcounties.org/news/

    .entry-title {
    font-size: 1.5rem;
    }

    Thanks again, you’ve helped me get this looking great, now I can focus on adding the content.

    Kind regards,

    Andrew.

    Thread Starter HenshawAC

    (@donaldsonac)

    Aw that’s fixed it, thank you!

    Is it possible to make the Posts titles smaller font?

    Thanks for you help, it’s greatly appreciated.

    Andrew.

    Thread Starter HenshawAC

    (@donaldsonac)

    @sacredheart Thank you so much, you’re awesome! This has fixed it and looks perfect now, it got rid of the page title and the News page excepts are full width thanks to your code.

    If I may pick your brains on one last thing, is it possible to get ride of the Featured Image from posts and make the Posts titles smaller font?

    As you see on
    https://britishcounties.org/daily-mail-12-sept-2017/
    https://britishcounties.org/letter-published-in-the-telegraph-10-september-2017/

    it takes the image from inside the article and uses that as the Featured Image, which looks terrible, it’s too big and when enlarged like it is is blurry.

    I tried a plugin to remove Featured Images but it didn’t work.

    Can that be done with CSS code?

    Thanks for your help, I really appreciate it.

    Andrew.

Viewing 15 replies - 1 through 15 (of 18 total)