This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// stolen from https://stackoverflow.com/questions/149055/how-can-i-format-numbers-as-dollars-currency-string-in-javascript | |
Number.prototype.formatMoney = function(c, d = '.', t = ','){ | |
var n = this, | |
c = isNaN(c = Math.abs(c)) ? 2 : c, | |
d = d == undefined ? "." : d, | |
t = t == undefined ? "," : t, | |
s = n < 0 ? "-" : "", | |
i = String(parseInt(n = Math.abs(Number(n) || 0).toFixed(c))), | |
j = (j = i.length) > 3 ? j % 3 : 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="img" style="background-image:url('http://i.imgur.com/tI5jq2c.jpg');"></div> | |
<div class="img" style="background-image:url('http://i.imgur.com/37w80TG.jpg');"></div> | |
<div class="img" style="background-image:url('http://i.imgur.com/B1MCOtx.jpg');"></div> | |
<style> | |
.img { | |
position: relative; | |
float: left; | |
width: 100px; | |
height: 100px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// taken from | |
// https://css-tricks.com/full-browser-width-bars/ | |
@mixin full-width-bar($background) { | |
position: relative; /* for the child pseudo-elements */ | |
/* negative offset = section padding */ | |
margin: 0 -30px; | |
/* add back section padding value */ | |
padding: 0.25rem 30px; | |
background: $background; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELETE pm | |
FROM wp_postmeta pm | |
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id | |
WHERE wp.ID IS NULL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First Attempt, seemed to have worked | |
SELECT DISTINCT(p.ID), p.post_title, p.post_content FROM `wp_posts` p | |
LEFT JOIN wp_posts im ON p.ID = im.post_parent AND im.post_type = "attachment" | |
WHERE p.post_status ='publish' | |
AND p.post_type = "product" | |
AND im.ID IS NULL | |
AND p.post_content NOT REGEXP 'src=".*"' | |
# This works well with woocommerce products. | |
# Fast |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELETE FROM wp_posts | |
WHERE id IN (SELECT * | |
FROM (SELECT id FROM wp_posts | |
GROUP BY post_title HAVING (COUNT(*) > 1) | |
) AS A | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Good for fixin urls | |
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'.',' '); | |
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,' ','-'); | |
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'--','-'); | |
UPDATE TABLE_NAME SET COLUMN = LOWER(COLUMN); | |
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Š','S'); | |
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'š','s'); | |
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ð','Dj'); | |
UPDATE TABLE_NAME SET COLUMN = REPLACE(COLUMN,'Ž','Z'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Adds "user defined" shortcodes via ACF options and repeater plugins | |
*/ | |
function addUserDefinedShortCodes() | |
{ | |
if( have_rows('codes','option') ): | |
// loop through the rows of data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addResponsivePixelToBody() | |
{ | |
$('body').append('<div id="xs-res" class="hidden-sm hidden-md hidden-lg"></div><div id="small-res" class="hidden-md hidden-xs hidden-lg"></div><div id="medium-res" class="hidden-sm hidden-xs hidden-lg"></div><div id="large-res" class="hidden-sm hidden-xs hidden-md"></div><div class="col-sm-12 col-md-4 text-center">'); | |
} | |
function responsiveBreakpoints() | |
{ | |
var xs = $('#xs-res'); | |
var small = $('#small-res'); | |
var med = $('#medium-res'); | |
var large = $('#large-res'); |