JavaScript version of var_dump

[et_pb_section admin_label=”section”][et_pb_row admin_label=”row”][et_pb_column type=”4_4″][et_pb_text admin_label=”Text” background_layout=”light” text_orientation=”left” use_border_color=”off” border_color=”#ffffff” border_style=”solid”]

<script>
function dump(obj) {
  var out = '';
  for (var i in obj) {
    out += i + ": " + obj[i] + "\n";
  }
  alert(out);
}
</script>

// or, if you wanted to avoid alerts and var_dump() on the page…

<script>
function dump(obj) {
  var out = '';
  for (var i in obj) {
    out += i + ": " + obj[i] + "\n";
  }
var pre = document.createElement('pre');
  pre.innerHTML = out;
  document.body.appendChild(pre)
}
</script>

// or var_dump() to the console…

<script>
function dump(obj) {
  var out = '';
  for (var i in obj) {
    out += i + ": " + obj[i] + "\n";
  }
  console.log(out);
}
</script>

 

[/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]

Divi Theme: Add Copyright & Add Social Icons to Footer

[et_pb_section admin_label=”section”][et_pb_row admin_label=”row”][et_pb_column type=”4_4″][et_pb_text admin_label=”Text” background_layout=”light” text_orientation=”left” use_border_color=”off” border_color=”#ffffff” border_style=”solid”]

Here’re a couple of Divi Theme tips & tricks:

[/et_pb_text][et_pb_text admin_label=”Text – Code – CSS Color Footer Social Media Icons on :hover” background_layout=”light” text_orientation=”left” use_border_color=”off” border_color=”#ffffff” border_style=”solid” module_class=”ourLilCodeSnippet”]

/* CSS Color Footer Social Media Icons on :hover */
#footer-bottom .et-social-facebook a:hover { color: blue; }
#footer-bottom .et-social-twitter a:hover { color: powderblue; }
#footer-bottom .et-social-linkedin a:hover { color: #1c87be; }
#footer-bottom .et-social-rss a:hover { color: orange; }

[/et_pb_text][/et_pb_column][/et_pb_row][et_pb_row admin_label=”row”][et_pb_column type=”4_4″][et_pb_text admin_label=”Text – JavaScript Footer” background_layout=”light” text_orientation=”left” use_border_color=”off” border_color=”#ffffff” border_style=”solid”]

Replace Divi’s footer shout out via JavaScript with a Copyright notice & also add a Social Media Icon (LinkedIn):

[/et_pb_text][et_pb_text admin_label=”Text – Code – JS Replace Divi stuff w Copyright in Footer + add LinkedIn icon” background_layout=”light” text_orientation=”left” use_border_color=”off” border_color=”#ffffff” border_style=”solid” module_class=”ourLilCodeSnippet”]

<script type=”text/javascript”>

/* replace Divi shout out w Copyright for My Company */

var theYear = new Date().getFullYear();
document.getElementById(‘footer-info’).innerHTML = ‘&copy; ‘+theYear+’ My Comany. All rights reserved.’;

/* Add LinkedIn Social Networking Icon */

jQuery(“#footer-bottom .et-social-icons”).append(‘<li class=”et-social-icon et-social-linkedin”><a href=”https://www.linkedin.com/company/the-dalai-lama-foundation” class=”icon”><span>LinkedIn</span></a></li>’)
</script>

[/et_pb_text][et_pb_text admin_label=”Text” background_layout=”light” text_orientation=”left” use_border_color=”off” border_color=”#ffffff” border_style=”solid”]

I’m using jQuery .append() to append the LinkedIn icon. You can choose other social media icons by using one from the approved list. You’ll find instructions on that page to create a Divi Child Theme, which you can modify to make these changes. Not sure why anyone would want to muck around w PHP, which might cause other issues if you’re not careful, when you can use JavaScript?

There are jQuery-less methods that are really easy if you’re using IDs for this, but a bit more challenging if you’re not… 😉

[/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]