Skip to content

Instantly share code, notes, and snippets.

View territutich's full-sized avatar

Terri Tutich territutich

View GitHub Profile
<?php
/**
* If page uses a specific template, load meta boxes
*
*/
add_action('add_meta_boxes', 'add_standardpg_meta');
function add_standardpg_meta() {
global $post;
<?php
/*
Template Name: Custom Feed
*/
$numposts = 5;
function yoast_rss_date( $timestamp = null ) {
$timestamp = ($timestamp==null) ? time() : $timestamp;
echo date(DATE_RSS, $timestamp);
@territutich
territutich / mailchimp-rss-feed-block.html
Created May 15, 2017 18:42
MailChimp RSS Feed block in Regular Campaign
*|FEEDBLOCK:http://www.example.com/feed/|**|FEEDITEMS:[$count=3]|*
<h3><a href="*|FEEDITEM:URL|*">*|FEEDITEM:TITLE|*</a></h3>
&nbsp;
<div style="float:right; margin-left:15px;">*|FEEDITEM:IMAGE|*</div>
*|FEEDITEM:CONTENT_TEXT|*<br />
<br />
Read the entire post at <a href="*|FEEDITEM:URL|*">*|FEEDITEM:URL|*</a><br />
<br />
<br />
@territutich
territutich / woo-featured-2-col.php
Created March 25, 2017 18:50
Woo 2 featured products two column
@territutich
territutich / archive-fellows.php
Last active July 6, 2016 13:58
Archive Template for Fellows Directory Original code from http://wpsites.net/web-design/basic-genesis-archive-page-template-for-custom-post-type/ Priority added for specificity.
<?php
/**
* @author Terri Orlowski
* @example http://torlowski.me/
* @copyright 2016 Terri Orlowski
*/
//* Remove the post meta function
remove_action( 'genesis_entry_footer', 'genesis_post_meta',6 );
@territutich
territutich / block-xmlrpc
Created May 31, 2016 20:50
Add this to .htaccess to block xmlrpc.php helps to prevent brute force attacks on sites.
# Block WordPress xmlrpc.php requests
<Files xmlrpc.php>
order deny,allow
deny from all
</Files>
ini_set('log_errors','On');
ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
@territutich
territutich / woo-3-products.php
Created May 4, 2016 23:00
Change WooCommerce to 3 products per row
// Change number or products per row to 3
add_filter('loop_shop_columns', 'loop_columns');
if (!function_exists('loop_columns')) {
function loop_columns() {
return 3; // 3 products per row
}
}
/* Remove Query Strings from static resources */
/* Add to functions.php */
function _remove_script_version( $src ){
$parts = explode( '?ver', $src );
return $parts[0];
}
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );
@territutich
territutich / gf_create_coupon.php
Created December 17, 2015 23:15
portion of code to create GF coupons based on user registration
function bto_create_builder_coupon($user_id) { // need to pass user data to this function
if( is_callable( 'gf_coupons' ) ) {
$user = get_user_by( 'id', $user_id );
//$meta['gravityForm'] = $form_id ? $form_id : 0;
$form_id = '16'; // would like this to be 0. Have tried 0, '0', and specific form id. Nothing is working properly.
$meta['couponName'] = $user->user_login . date('M d, Y');
//$coupon_code = substr($user->user_firstname,0, 1) . substr($user->user_lastname, 0, 3) . date('ymd');
$meta['couponCode'] = strtoupper($user->user_login . date('ymd'));
$meta['couponAmountType'] = 'percentage';
$meta['couponAmount'] = 100;