Skip to content

Instantly share code, notes, and snippets.

SEMALT CODE IN HTACCESS
<Limit GET HEAD POST>
order allow,deny
deny from semalt.com
allow from all
</LIMIT>
#Semalt redirection
RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?semalt.com.*$ [NC]
#### Robots.txt file to block others
User-agent: MJ12bot*
Disallow: /
User-agent: NinjaBot
Allow: /
User-agent: Mediapartners-Google*
Allow: /
/* Password Protect Admin section */
ErrorDocument 401 "Unauthorized Access"
ErrorDocument 403 "Forbidden"
<FilesMatch "wp-login.php">
AuthName "Authorized Only"
AuthType Basic
AuthUserFile /home/username/.htpaswrdname
require valid-user
</FilesMatch>
/* iFrame Buster */
<script language="javascript" type="text/javascript">
//if (window!= top) top.location.href = location.href;
(function(window) {
if (window.location !== window.top.location) {
window.top.location = window.location;
}
})(this);
</script>
SELECT post.post_title, post.post_name, tt.name
FROM `wp_posts` AS post
INNER JOIN `wp_term_relationships` AS terms ON ( post.ID = terms.object_id )
INNER JOIN `wp_term_taxonomy` AS tax ON ( terms.term_taxonomy_id = tax.term_taxonomy_id )
INNER JOIN `wp_terms` AS tt ON ( tax.term_id = tt.term_id )
WHERE post.post_type = 'post'
@klongdesigns
klongdesigns / font-sizing rems.less
Last active August 29, 2015 14:04
Less file for setting font sizes in rem
//mixin declaration
.font-size(@sizeValue) {
@remValue: @sizeValue;
@pxValue: @sizeValue;
font-size: ~"@{pxValue}px";
font-size: ~"@{remValue}rem";
}
//media queries set
@klongdesigns
klongdesigns / ga-event-tracking-analytics
Created August 28, 2014 19:52
Google Analytics event tracking code for WordPress
function sendToGA(pagename,section) {
ga('send', {
'hitType': 'event', // Required.
'eventCategory': 'footerLink', // Required.
'eventAction': 'click', // Required.
'eventLabel': 'Footer Link: ' + section,
'eventValue': 4,
'page':'/'+pagename,
});
}
@klongdesigns
klongdesigns / ga-demographics
Created September 5, 2014 14:18
Google Analytics Demographic add lin
//for universal analytics
ga('require', 'displayfeatures');
@klongdesigns
klongdesigns / cron-job
Created September 15, 2014 17:29
Cron Job for Wordpress posts setup
php -q /home/survivi/public_html/wp-cron.php
@klongdesigns
klongdesigns / 0_reuse_code.js
Last active August 29, 2015 14:12
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console