{"id":2069,"date":"2012-09-27T19:33:11","date_gmt":"2012-09-27T18:33:11","guid":{"rendered":"http:\/\/ed.primaryblogger.co.uk\/?p=2069"},"modified":"2012-09-27T19:33:11","modified_gmt":"2012-09-27T18:33:11","slug":"loading-typekit-asynchronously-in-the-wordpress-admin-bar","status":"publish","type":"post","link":"https:\/\/ed.gs\/2012\/09\/27\/loading-typekit-asynchronously-in-the-wordpress-admin-bar\/","title":{"rendered":"Loading TypeKit Asynchronously In The WordPress Admin Bar"},"content":{"rendered":"

I managed to persuade Primary Technology to buy a TypeKit account for the company to use, so I decided what better way to test it than use it globally on PrimaryBlogger in the admin bar and admin dashboard area.<\/p>\n

Here’s how I added the code to load when the admin menu bar was showing only, if it’s disabled then the code won’t display (this is useful as we like to keep static file requests to a minimum):<\/p>\n

function typekit_admin_menu() {\n?>\n\n  (function() {\n    var config = {\n      kitId: 'typekitidhere',\n      scriptTimeout: 3000\n    };\n    var h=document.getElementsByTagName("html")[0];h.className+=" wf-loading";var t=setTimeout(function(){h.className=h.className.replace(/(\\s|^)wf-loading(\\s|$)/g," ");h.className+=" wf-inactive"},config.scriptTimeout);var \ntk=document.createElement("script"),d=false;tk.src='//use.typekit.net/'+config.kitId+'.js';tk.type="text/javascript";tk.async="true";tk.onload=tk.onreadystatechange=function(){var \na=this.readyState;if(d||a&&a!="complete"&&a!="loaded")return;d=true;clearTimeout(t);try{Typekit.load(config)}catch(b){}};var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(tk,s)\n  })();\n\n<?php\n}\nadd_action('admin_bar_menu', 'typekit_admin_menu');<\/pre>\n","protected":false},"excerpt":{"rendered":"

I managed to persuade Primary Technology to buy a TypeKit account for the company to use, so I decided what better way to test it than use it globally on PrimaryBlogger in the admin bar and admin dashboard area. Here’s how I added the code to load when the admin menu bar was showing only, […]<\/p>\n","protected":false},"author":2,"featured_media":3535,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ep_exclude_from_search":false},"categories":[26,75,76],"tags":[],"yoast_head":"\nLoading TypeKit Asynchronously In The WordPress Admin Bar - E<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ed.gs\/2012\/09\/27\/loading-typekit-asynchronously-in-the-wordpress-admin-bar\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Loading TypeKit Asynchronously In The WordPress Admin Bar - E\" \/>\n<meta property=\"og:description\" content=\"I managed to persuade Primary Technology to buy a TypeKit account for the company to use, so I decided what better way to test it than use it globally on PrimaryBlogger in the admin bar and admin dashboard area. Here’s how I added the code to load when the admin menu bar was showing only, […]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ed.gs\/2012\/09\/27\/loading-typekit-asynchronously-in-the-wordpress-admin-bar\/\" \/>\n<meta property=\"og:site_name\" content=\"E\" \/>\n<meta property=\"article:published_time\" content=\"2012-09-27T18:33:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/static.ed.gs\/wp-content\/uploads\/2012\/10\/197H.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"2048\" \/>\n\t<meta property=\"og:image:height\" content=\"1365\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Ed\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ed\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ed.gs\/2012\/09\/27\/loading-typekit-asynchronously-in-the-wordpress-admin-bar\/\",\"url\":\"https:\/\/ed.gs\/2012\/09\/27\/loading-typekit-asynchronously-in-the-wordpress-admin-bar\/\",\"name\":\"Loading TypeKit Asynchronously In The WordPress Admin Bar - E\",\"isPartOf\":{\"@id\":\"https:\/\/ed.gs\/#website\"},\"datePublished\":\"2012-09-27T18:33:11+00:00\",\"dateModified\":\"2012-09-27T18:33:11+00:00\",\"author\":{\"@id\":\"https:\/\/ed.gs\/#\/schema\/person\/d775615f2296ad0129fa3ea66346c628\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ed.gs\/2012\/09\/27\/loading-typekit-asynchronously-in-the-wordpress-admin-bar\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ed.gs\/#website\",\"url\":\"https:\/\/ed.gs\/\",\"name\":\"E\",\"description\":\"automation, consultancy, project management, web\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/ed.gs\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/ed.gs\/#\/schema\/person\/d775615f2296ad0129fa3ea66346c628\",\"name\":\"Ed\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/ed.gs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4fe1dfaed09e6bdceb557d3008f5cc47?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4fe1dfaed09e6bdceb557d3008f5cc47?s=96&d=mm&r=g\",\"caption\":\"Ed\"},\"url\":\"https:\/\/ed.gs\/author\/ed\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Loading TypeKit Asynchronously In The WordPress Admin Bar - E","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ed.gs\/2012\/09\/27\/loading-typekit-asynchronously-in-the-wordpress-admin-bar\/","og_locale":"en_GB","og_type":"article","og_title":"Loading TypeKit Asynchronously In The WordPress Admin Bar - E","og_description":"I managed to persuade Primary Technology to buy a TypeKit account for the company to use, so I decided what better way to test it than use it globally on PrimaryBlogger in the admin bar and admin dashboard area. Here’s how I added the code to load when the admin menu bar was showing only, […]","og_url":"https:\/\/ed.gs\/2012\/09\/27\/loading-typekit-asynchronously-in-the-wordpress-admin-bar\/","og_site_name":"E","article_published_time":"2012-09-27T18:33:11+00:00","og_image":[{"width":2048,"height":1365,"url":"https:\/\/static.ed.gs\/wp-content\/uploads\/2012\/10\/197H.jpg","type":"image\/jpeg"}],"author":"Ed","twitter_misc":{"Written by":"Ed","Estimated reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/ed.gs\/2012\/09\/27\/loading-typekit-asynchronously-in-the-wordpress-admin-bar\/","url":"https:\/\/ed.gs\/2012\/09\/27\/loading-typekit-asynchronously-in-the-wordpress-admin-bar\/","name":"Loading TypeKit Asynchronously In The WordPress Admin Bar - E","isPartOf":{"@id":"https:\/\/ed.gs\/#website"},"datePublished":"2012-09-27T18:33:11+00:00","dateModified":"2012-09-27T18:33:11+00:00","author":{"@id":"https:\/\/ed.gs\/#\/schema\/person\/d775615f2296ad0129fa3ea66346c628"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ed.gs\/2012\/09\/27\/loading-typekit-asynchronously-in-the-wordpress-admin-bar\/"]}]},{"@type":"WebSite","@id":"https:\/\/ed.gs\/#website","url":"https:\/\/ed.gs\/","name":"E","description":"automation, consultancy, project management, web","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ed.gs\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/ed.gs\/#\/schema\/person\/d775615f2296ad0129fa3ea66346c628","name":"Ed","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/ed.gs\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4fe1dfaed09e6bdceb557d3008f5cc47?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4fe1dfaed09e6bdceb557d3008f5cc47?s=96&d=mm&r=g","caption":"Ed"},"url":"https:\/\/ed.gs\/author\/ed\/"}]}},"_links":{"self":[{"href":"https:\/\/ed.gs\/wp-json\/wp\/v2\/posts\/2069"}],"collection":[{"href":"https:\/\/ed.gs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ed.gs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ed.gs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ed.gs\/wp-json\/wp\/v2\/comments?post=2069"}],"version-history":[{"count":0,"href":"https:\/\/ed.gs\/wp-json\/wp\/v2\/posts\/2069\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ed.gs\/wp-json\/wp\/v2\/media\/3535"}],"wp:attachment":[{"href":"https:\/\/ed.gs\/wp-json\/wp\/v2\/media?parent=2069"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ed.gs\/wp-json\/wp\/v2\/categories?post=2069"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ed.gs\/wp-json\/wp\/v2\/tags?post=2069"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}