Handy one-liners for sed
Mar. 23, 2001 - version 5.1 - compiled by Eric Pement [email protected]
Latest version of this file is usually at:
-
This file is also available in Portuguese at:
Mar. 23, 2001 - version 5.1 - compiled by Eric Pement [email protected]
Latest version of this file is usually at:
This file is also available in Portuguese at:
<?php | |
/* | |
* dl-file.php | |
* | |
* Protect uploaded files with login. | |
* | |
* @link http://wordpress.stackexchange.com/questions/37144/protect-wordpress-uploads-if-user-is-not-logged-in | |
* | |
* @author hakre <http://hakre.wordpress.com/> | |
* @license GPL-3.0+ |
<?php | |
/* | |
* Entfernt das Gravatar aus der Toolbar. | |
* @link: http://talkpress.de/artikel/wordpress-admin-bar-datenkrake-missbrauch | |
*/ | |
/* < PHP 5.3 */ | |
function ds_add_hide_avatar_filter() { | |
add_filter( 'pre_option_show_avatars', '__return_zero' ); | |
} |
<?php | |
/* | |
Plugin Name: R Debug | |
Description: Set of dump helpers for debug. | |
Author: Andrey "Rarst" Savchenko | |
Author URI: https://www.rarst.net/ | |
License: MIT | |
*/ |
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref | |
<?php | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.github.io | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php | |
*/ |
// Make two admin-only fields (as text fields) | |
// and post to the custom fields from Gravity Forms | |
// instead of the "real" date picker. | |
// NOTE: change the input IDs to match the ones on your form | |
function rkv_datesubmit_fix ($form){ | |
//event start date field id is 3 | |
//event end date field ID is 4 | |
$raw_srt = $_POST['input_3']; | |
$raw_end = $_POST['input_4']; |
<?php | |
/*-----------------------------------------------------------------------------------*/ | |
/* Conditional Logic to Detect Various Event Related Views/Pages | |
/*-----------------------------------------------------------------------------------*/ | |
if( tribe_is_month() && !is_tax() ) { // Month View Page | |
echo 'were on the month view page'; | |
} elseif( tribe_is_month() && is_tax() ) { // Month View Category Page |
<?php | |
/* gform_pre_submission will do all forms. gform_pre_submission_1 will do a form with an ID of 1 | |
* Keep an eye on the priority of the filter. In this case I used 9 because the Salesforce plugin we used ran a presubmission filter at 10 so we needed this to happen before it | |
*/ | |
add_filter( "gform_pre_submission_1", "add_salesforce_campaign_id_footer", 9 ); | |
function add_salesforce_campaign_id_footer( $form ){ | |
foreach($form["fields"] as &$field) | |
if($field["id"] == 2){ | |
/* Set the variable you want here - in some cases you might need a switch based on the page ID. | |
* $page_id = get_the_ID(); |
<?php | |
/** | |
* Bail out if running an autosave, ajax or a cron | |
* or user does not have proper capabilities | |
* | |
* @return bool|int True if should bail, post ID if lacking cap | |
*/ | |
function wps_bail( $post_id = '', $cap = 'edit_post' ) { | |
/** Bail out if running an autosave */ |