Skip to content

Instantly share code, notes, and snippets.

View anthonysbrown's full-sized avatar

Anthony Brown anthonysbrown

  • Worcester, MA USA
View GitHub Profile
<title><?php wp_title( '|', true, 'right' ); ?></title>
@anthonysbrown
anthonysbrown / functions.php
Last active January 3, 2020 19:15
Add a disclaimer on product pages by category
<?php
#Read article here https://worcesterwideweb.com/woocommerce-add-single-product-notice-on-a-per-category-basis-with-hierarchy/
add_filter( 'the_content', 'customizing_woocommerce_description' );
function customizing_woocommerce_description( $content ) {
global $post;
// Only for single product pages (woocommerce)
if ( is_product() ) {
# get the terms for this post
$terms = get_the_terms( $post->ID, 'product_cat' );
@anthonysbrown
anthonysbrown / functions.php
Last active November 27, 2019 18:07
Woocommerce check page ID and if not there then set it.
<?php
/*
Function: Check Pages to see if WooCommerce pages are set.
Description: Woocommerce check page ID and if not there then set it. Sometimes the woocommerce pages because unset for some reasons, use this to check it and set it automatically.
Params: None
Author: Anthony Brown (Codeable)
Email: anthony@worcesterwideweb.com
*/
function check_wp_pages_installed(){
@anthonysbrown
anthonysbrown / woocommerce-pending-subscriptions-retry.php
Last active August 27, 2019 23:38
Retry Woocommerce Pending and subscriptions if your gateway has an error or fails. Go to your site ?retry=1
<?php
/**
* Plugin Name: WooCommerce Subscriptions Pending payment fix
*/
$wc_pending_payment_fix = new wc_pending_payment_fix;
add_action('init', array($wc_pending_payment_fix, 'retry_payments'));
class wc_pending_payment_fix{
@anthonysbrown
anthonysbrown / template.php
Created April 29, 2019 15:30
template.php
<?php
#service date
if($burial_date != ''){
echo '<p class="wpfh-service-line"><strong>'.get_option('wpfh_burial_date_text',__("Burial Date","sp-wpfh")).'</strong> ' .$burial_date . '</p>';
}
#service lines
if(wpfh_feature_disabled('Obituary: Service Lines') != true){
$services_information =array();
@anthonysbrown
anthonysbrown / feed.json
Created March 27, 2019 14:05
feed.json
{
"current_page": 1,
"data": [
{
"id": 12209,
"title": "Taste Of The Wild High Prairie Dry Dog Food",
"brand": "Taste Of The Wild",
"description": "&lt;html&gt;&lt;p&gt;Taste of the Wild High Prairie Dry Dog Food is a roasted bison and venison, grain-free recipe with sweet potatoes and peas providing healthy, digestible energy for your active dog. With roasted buffalo as the first ingredient, this diet mimics an ancestral diet free of grains, packed with real meat and supplemented with fruits and vegetables. Taste of the Wild High Prairie delivers antioxidants and vitamins and minerals for a healthy lifestyle with no fillers or by-products.&lt;/p&gt;&lt;br /&gt;&lt;h3&gt;Why We Love It&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Grain-free recipe to mimic an ancestral diet&lt;/li&gt;&lt;li&gt;High protein diet supplemented with fruits and vegetables&lt;/li&gt;&lt;li&gt;Made in the USA!&lt;/li&gt;&lt;/ul&gt;&lt;/html&gt;\r\n\r\n&lt;h3&gt;About Taste of the Wi
@anthonysbrown
anthonysbrown / function.php
Last active February 27, 2019 20:20
function.php
<?php
/**
* Plugin Name: Gravity Forms Authorize.net Custom Fields
* Plugin URI: http://codeable.io
* Description: GF Extra fields for beyer
* Author: Anthony Brown
* Author URI: http://codeable.io
* Version: 1.0.0
* WC tested up to: 3.5.4
@anthonysbrown
anthonysbrown / upload-file.php
Created February 20, 2019 14:31
CDM Upload File
<?php
#make the directory
$upload_dir = '' . SP_CDM_UPLOADS_DIR . '' . $uid . '/';
if (!is_dir(SP_CDM_UPLOADS_DIR)) {
mkdir(SP_CDM_UPLOADS_DIR, 0777);
}
if (!is_dir($dir)) {
mkdir($dir, 0777);
}
@anthonysbrown
anthonysbrown / functions.php
Last active May 30, 2018 14:40
CDM change image icon
<?php
add_filter('sp_cdm_viewfile_image', '_cdm_custom_images',10,2);
function _cdm_custom_images($img,$r){
$ext = preg_replace('/^.*\./', '', $r['file']);
if ($ext == 'pdf') {
<?php
add_action('wp_head','_express_css');
function _express_css(){
if($_COOKIE['viewed_cookie_policy'] == ''){
echo '<style type="text/css">
.footer-padding{margin-bottom:45px}