/** * Theme functions file */ jQuery(document).ready(function($){ // alert('test'); // hide header image if the page also has a featured image START if($(".has-post-thumbnail").length!==0){ $("#site-header").remove(); $("body").addClass("has-post-thumb"); } // hide header image if the page also has a featured image END // external links to tab START $('a').each(function() { var a = new RegExp('/' + window.location.host + '/'); if (!a.test(this.href)) { $(this).attr("target","_blank"); } }); // external links to tab END // sort sidebar widget alphabethically START var mylist = $('#pis_posts_in_sidebar-2 ul'); var listitems = mylist.children('li').get(); listitems.sort(function(a, b) { return $(a).text().toUpperCase().localeCompare($(b).text().toUpperCase()); }) $.each(listitems, function(idx, itm) { mylist.append(itm); }); // sort sidebar widget alphabethically END }); // Responsive jQuery(window).on("load resize scroll",function(e){ var pageWidth = jQuery(window).width(); if( jQuery(window).width()>846){ //alert("more than @media screen and (min-width: 846px)"); } else { //alert("less than @media screen and (min-width: 846px)"); } });