Skip to content

Instantly share code, notes, and snippets.

@zeropointdevelopment
zeropointdevelopment / code-snippet-1.txt
Created December 27, 2013 05:43
[WordPress] Code from our blog page Stop Image Hotlinking - http://www.limecanvas.com/stop-image-hotlinking/
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mysite\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/hotlinking-thief.jpg [L]
@zeropointdevelopment
zeropointdevelopment / code-snippet-1.html
Last active January 1, 2016 12:09
[WordPress] Code from our blog page Developing A Facebook Tabs iFrame Application - http://www.limecanvas.com/developing-a-facebook-tabs-iframe-application/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>My New App</title>
<link href="css/styles.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="wrapper">
<div id="main">
@zeropointdevelopment
zeropointdevelopment / code-snippet-1.txt
Created December 27, 2013 05:54
[WordPress] Code from our blog post Securing the WordPress Uploads Folder - http://www.limecanvas.com/securing-the-wordpress-uploads-folder/
<Files ~ ".*..*">
Order Allow,Deny
Deny from all
</Files>
<FilesMatch ".(jpg|jpeg|jpe|gif|png|tif|tiff)$">
Order Deny,Allow
Allow from all
</FilesMatch>
@zeropointdevelopment
zeropointdevelopment / code-snippet-1.php
Last active January 1, 2016 12:09
[WordPress] Code from our blog post Integrating JetPack Infinite Scroll with Genesis - http://www.limecanvas.com/integrating-jetpack-infinite-scroll-with-genesis/
/**
* Add support for JetPack infinite scroll
**/
function lc_infinite_scroll_init() {
add_theme_support( 'infinite-scroll', array(
'container' =&gt; 'content',
'footer' =&gt; 'footer',
'render' =&gt; 'genesis_do_loop'
) );
}
@zeropointdevelopment
zeropointdevelopment / code-snippet-1.php
Created December 27, 2013 04:54
[WordPress] Code from our blog post How to get Gallery Images in WordPress 3.5 - http://www.limecanvas.com/how-to-get-gallery-images-in-wordpress-3-5/
/** Grab IDs from new WP 3.5 gallery **/
function lc_grab_ids_from_gallery() {
global $post;
$attachment_ids = array();
$pattern = get_shortcode_regex();
$ids = array();
if (preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches ) ) { //finds the "gallery" shortcode and puts the image ids in an associative array at $matches[3]
$count=count($matches[3]); //in case there is more than one gallery in the post.
@zeropointdevelopment
zeropointdevelopment / code-snippet-1.php
Last active January 1, 2016 12:09
[WordPress] Code from our blog post Using the Infinite Scroll Module in JetPack - http://www.limecanvas.com/using-the-infinite-scroll-module-in-jetpack/
/**
* Add support for JetPack infinite scroll
**/
add_theme_support( 'infinite-scroll', array(
'container' =&gt; 'content',
'footer' =&gt; 'page',
)
);
@zeropointdevelopment
zeropointdevelopment / code-snippet-1.php
Last active January 1, 2016 12:09
[WordPress] Code from our blog post Customising the JetPack Infinite Scroll Footer - http://www.limecanvas.com/customising-the-jetpack-infinite-scroll-footer/
/**
* The Infinite Blog Footer
*
* @uses self::get_settings, self::set_last_post_time, self::archive_supports_infinity, __, wp_get_theme, get_current_theme, apply_filters, home_url, esc_attr, get_bloginfo, bloginfo
* @return string or null
*/
function footer() {
// Bail if theme requested footer not show
if ( false == self::get_settings()->footer )
return;
@zeropointdevelopment
zeropointdevelopment / code-snippet-1.php
Created December 27, 2013 04:59
[WordPress] Code from our blog post Pimp My WordPress Maintenance Mode Message - http://www.limecanvas.com/pimp-my-wordpress-maintenance-mode-message/
if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) {
require_once( WP_CONTENT_DIR . '/maintenance.php' );
die();
}
@zeropointdevelopment
zeropointdevelopment / code-snippet-1.php
Created December 27, 2013 04:46
[WordPress] Code from our blog post Passing Parameters to a Video Link in a WordPress Custom Field - http://www.limecanvas.com/passing-parameters-to-a-video-link-in-a-wordpress-custom-field/
// Filter video output
add_filter('oembed_result','lc_oembed_result', 10, 3);
function lc_oembed_result($html, $url, $args) {
// $args includes custom argument
$newargs = $args;
// get rid of discover=true argument
array_pop( $newargs );
@zeropointdevelopment
zeropointdevelopment / code-snippet-1.php
Last active January 1, 2016 12:09
[WordPress] Code from our blog post A MailChimp Opt-in Field for Contact Form 7 - http://www.limecanvas.com/a-mailchimp-opt-in-field-for-contact-form-7/
[ text* your-name 58/ ]
[ email* your-email 58/ ]
[ checkbox mailchimp-optin default:1 use_label_element "Subscribe to our newsletter" ]