Skip to content

Instantly share code, notes, and snippets.

View samjco's full-sized avatar

Sam C. samjco

View GitHub Profile
<?php
add_filter( 'caldera_forms_submission_url', function( $url, $form_id ){
if( 'CF582e6cf914f03' == $form_id ){
$url = 'https://somesite.com/api';
}
return $url;
}, 25, 2 );
@thierrypigot
thierrypigot / acf-missing.php
Created June 3, 2016 10:13
WordPress mu plugins to check if "Advanced Custom Fields Pro" is active.
<?php
if( !class_exists('acf') )
{
$tp_acf_notice_msg = __( 'This website needs "Advanced Custom Fields Pro" to run. Please download and activate it', 'tp-notice-acf' );
/*
* Admin notice
*/
add_action( 'admin_notices', 'tp_notice_missing_acf' );
function tp_notice_missing_acf()
@Spencer-Easton
Spencer-Easton / exportSpreadsheet.gs
Last active March 21, 2024 00:43
Example on how to export a Google sheet to various formats, includes most PDF options
function exportSpreadsheet() {
//All requests must include id in the path and a format parameter
//https://docs.google.com/spreadsheets/d/{SpreadsheetId}/export
//FORMATS WITH NO ADDITIONAL OPTIONS
//format=xlsx //excel
//format=ods //Open Document Spreadsheet
//format=zip //html zipped
@RickeyMessick
RickeyMessick / Gravity Forms get all fields function
Created November 3, 2015 21:11
Gravity Forms get all fields function to use with gform_after_submission to display just filled out fields
function get_all_fields($entry, $form)
{
//only do this for a certain form (id 53 for example)
// if ($form["id"] == 17)
//{
foreach($form["fields"] as &$field)
{
//see if this is a multi-field, like name or address
if (is_array($field["inputs"]))
@srikat
srikat / functions.php
Last active July 19, 2017 05:37
How to display Posts from a Category in columns using Display Posts Shortcode. https://sridharkatakam.com/how-to-display-posts-from-a-category-in-columns-using-display-posts-shortcode/
// Register a custom image size for Featured Category images
add_image_size( 'featured-cat-image', 300, 200, true );
/**
* Add Column Classes to Display Posts Shortcodes
* @author Bill Erickson
* @link http://www.billerickson.net/code/add-column-classes-to-display-posts-shortcode
*
* Usage: [display-posts columns="2"]
*
<?php
/*
Plugin Name: Custom Caldera Forms Field
*/
add_filter('caldera_forms_get_field_types', 'slug_add_field');
function slug_add_field($fieldtypes){
$fieldtypes['field_name'] = array(
"field" => "Field Name",
@kcpt-steven-kohlmeyer
kcpt-steven-kohlmeyer / query-hooks.php
Created February 9, 2015 22:51
Virtual URLs to modify query
<?php
function add_custom_query_vars($vars) {
$vars[] = "past_events";
return $vars;
}
// hook add_query_vars function into query_vars
add_filter('query_vars', 'add_custom_query_vars');
@kcpt-steven-kohlmeyer
kcpt-steven-kohlmeyer / redirect-subscriber.php
Created February 9, 2015 21:25
Wordpress: Redirect subscribers from accessing admin.
<?php
global $current_user; // Use global
get_currentuserinfo(); // Make sure global is set, if not set it.
if ( user_can( $current_user, "subscriber" ) ) {
// Disable admin bar for subscribers
show_admin_bar(false);
@danielpataki
danielpataki / author-removal.php
Last active December 18, 2018 23:10
Modifying Twenty Fifteen
<?php
// Author bio.
if ( is_single() && get_the_author_meta( 'description' ) ) :
get_template_part( 'author-bio' );
endif;
?>
@scottopolis
scottopolis / gist:07c555b9dd0581497f0b
Last active March 16, 2019 20:51
Styling for Display Posts Shortcode
/* Author: Scott Bolinger
* Author URI: http://apppresser.com
*
* Styling for Display Posts Shortcode plugin for use with the AppTheme. Add this code to a child theme style.css file.
* Plugin information: http://www.billerickson.net/shortcode-to-display-posts/
*
*/
ul.display-posts-listing {
list-style-type: none;