Show Menu
Cheatography

Useful Dev Cheat Sheet Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Phone Number Changing Header

<script>
var shortNumber = $("#clickToShow").text().substring(0,  $("#clickToShow").text().length - 2);
var eventTracking = "ga('send', 'event', 'phone', 'click', 'header');";
$("#clickToShow").hide().after('<a id="clickToShowButton" onClick="' + eventTracking + '">' + shortNumber + '...</a>');
$("#clickToShowButton").click(function() {
    $("#clickToShow").css( "display", "block" );
    $("#clickToShowButton").hide();
});
</script>
Give the Phone number the id of #click­ToShow

If for some reason the phone number after being clicked is going to the next line please change the "­blo­ck" attribute into "­inl­ine­"

Two Google Analytics Codes One Site

<script>

  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

 // Standard code. Replace X's and domain with your own
ga('create', 'UA-XXXXXXXX-X', 'auto');

// Replace Y's with your account number. "b" can be anything you want.
ga('create', 'UA-YYYYYYYY-Y', {'name':'b'});

// Standard code. No change necessary.
ga('send', 'pageview');

// "b" can again be anything you want, but it MUST match "b" above.
ga('b.send', 'pageview');

 </script>
 

Read More Tag

<script>
(function($) {
$('#show').click(function(e) {
    $('#cdscontainer').toggle();
});
$('#hide').click(function(e) {
    $('#cdscontainer').toggle();
});
})( jQuery );
</script>
To hide the content add in the main CSS file

#cdsco­ntainer {
display: none;
}

This goes to the content you want to hide

<a id="­sho­w"> …Readm­ore­</a­></­p><div id="­cds­con­tai­ner­">
Paste text here…..
<a id="­hid­e"> …Hide conten­t</­a><­/di­v>

If for some reason your jQuery is not working find more relevant inform­ation here https:­//p­rem­ium.wp­mud­ev.o­rg­/bl­og/­add­ing­-jq­uer­y-s­cri­pts­-wo­rdp­ress/