Skip to content

Instantly share code, notes, and snippets.

Anthony Brown anthonysbrown

Block or report user

Report or block anthonysbrown

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@anthonysbrown
anthonysbrown / functions.php
Last active Jan 3, 2020
Add a disclaimer on product pages by category
View functions.php
<?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 Nov 27, 2019
Woocommerce check page ID and if not there then set it.
View functions.php
<?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(){
View 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();
View 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
View 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
View upload-file.php
<?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
CDM change image icon
View functions.php
<?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') {
View gist:8d6e083a3503981b63e0a171f19730a5
<?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}
@anthonysbrown
anthonysbrown / functions.php
Created May 17, 2018
Add Yoast SEO support for Optima Express
View functions.php
<?php
add_action('wpseo_title','optima_wpseo');
function optima_wpseo($title ){
global $post;
if ($post->ID == 0 && $post->post_author == 0 && $post->post_type == 'page') {
@anthonysbrown
anthonysbrown / functions.php
Created Apr 30, 2018
Add a custom cdm css file
View functions.php
<?php
function cdm_custom_styles() {
wp_enqueue_style( 'my-cdm-custom-styles', get_stylesheet_directory_uri().'cdm.css', array('cdm-style','cdm-premium-style') );
}
add_action( 'wp_enqueue_scripts', 'cdm_custom_styles' );
?>
You can’t perform that action at this time.