Skip to content

Instantly share code, notes, and snippets.

View richerimage's full-sized avatar

Richard Barratt richerimage

View GitHub Profile
@richerimage
richerimage / Get Content from Post ID.php
Created July 1, 2016 08:26
Get Content from Post ID
$post_id = 7;
echo apply_filters('the_content', get_post_field('post_title', $post_id));
echo get_post_field('post_content', $post_id));
echo get_post_meta($post_id, 'thesis_thumb_height', true);
http://domain.com?utm_campaign=openingsale&utm_medium=social&utm_source=facebook
http://domain.com?utm_campaign=openingsale&utm_medium=print&utm_source=newspaperqcode
@richerimage
richerimage / Get Contact by ID.php
Last active May 16, 2016 04:55
Get post/Page content by ID
<?php
$id = '123';
echo get_post_field('post_content', $id);
// Want it formatted?
echo apply_filters('the_content', get_post_field('post_content', $id));
@richerimage
richerimage / thesis_template_conditional.php
Created May 5, 2016 04:39
Conditional php statement based upon active Thesis 2 template
/*
* Thesis API: new is_template() method can be used to determine which template is currently rendering on the front end
*
* Check which Thesis template is currently running.
* Note: This method uses the proper template name (such as "Landing Page")
* Props: Girlie
*
*/
public function is_template($name = '') {
@richerimage
richerimage / conditional_excerpt_length.php
Created May 4, 2016 14:32
conditional_excerpt_length
add_filter( 'excerpt_length', 'conditional_excerpt_length' );
function conditional_excerpt_length($length) {
if ( is_front_page() )
return 80; // Change value as desired
else
return $length;
}
// ADDING CUSTOM POST TYPE (via http://mikevoermans.com/)
add_action('init', 'all_custom_post_types');
function all_custom_post_types() {
$types = array(
// News and Events
@richerimage
richerimage / max_input_vars.txt
Created November 23, 2015 11:17
Max Input Vars
// php.ini
max_input_vars = 5000
suhosin.post.max_vars = 5000
suhosin.request.max_vars = 5000
# To see php info, create a file named info.php.
<?php phpinfo(); ?>
@richerimage
richerimage / mailchimp-conditionals.txt
Last active December 19, 2016 14:08
Mailchimp Conditional
Hello *|IF:FNAME|*
*|TITLE:FNAME|*,
*|ELSE:|*
Friend,
*|END:IF|*
Hello*|IF:FNAME|* *|TITLE:FNAME|*,*|ELSE:|*,*|END:IF|*
@richerimage
richerimage / spf
Last active August 29, 2015 14:21
SPF .txt record for Plesk
v=spf1 a mx ip4:72.10.34.86 -all
http://mediatemple.net/community/products/dv/204404314/how-can-i-create-an-spf-record-for-my-domain
@richerimage
richerimage / 301 redirects wordpress
Last active August 29, 2015 14:21
301 redirects
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# BEGIN Permanent URL redirects. NB: 1st one is homepage
RewriteRule ^ http://newdomain/? [L,R=301,NC]
RewriteRule ^blog/ http://newdomain/blog/? [L,R=301,NC]
RewriteRule ^about/ http://newdomain/about/? [L,R=301,NC]