Skip to content

Instantly share code, notes, and snippets.

<?php
add_filter('upload_dir', 'cgg_upload_dir');
function cgg_upload_dir($dir)
{
// xxx Lots of $_REQUEST usage in here, not a great idea.
// Are we where we want to be?
if (!isset($_REQUEST['action']) || 'upload-attachment' !== $_REQUEST['action']) {
return $dir;
}
<?php
add_action('save_post', 'cgg_proper_save_post', 10, 2);
// first off: it doesn't matter if you return anything from this function
// `save_post` is an action, nothing is done with the return values of its
// callbacks. You're free to return $post_id if you want, obviously, but
// it's not a filter.
function cgg_proper_save_post($post_id, $post)
{
<?php
/*
Plugin Name: Editors Add Users
Description: Allow editors to add user roles
Author: Christopher Davis
Author URI: http://www.christopherguitar.me
License: GPL2
*/
register_activation_hook( __FILE__, 'wpse42003_activation' );
<?php
get_header(); // Loads the header.php template. ?>
<?php
if ( is_tax( 'post_format', 'post-format-video' ) ) {
if ( isset( $_GET['video_id'] ) ) {
$video_id = absint( $_GET['video_id'] );
} else {
<?php
/**
* Plugin Name: EDD Paytrail Gateway
* Plugin URI: https://foxnet-themes.fi/downloads/edd-paytrail/
* Description: Adds Paytrail payment gateway to Easy Digital Downloads plugin
* Version: 1.0.0
* Author: Sami Keijonen
* Author URI: https://foxnet-themes.fi
* Text Domain: edd-paytrail
* Domain Path: /languages
<?php
function tgm_beauty_review_layout() {
global $amm_core;
global $wp_query;
$paged = ( get_query_var('page') ) ? get_query_var( 'page' ) : 1;
$wp_query = new WP_Query(
array(
'paged' => $paged,
'post_status' => 'publish',
'posts_per_page' => 5,
<?php
/*
Plugin Name: Retroactive BP User Acticity
Plugin URI: https://gist.github.com/3953927
Description: Makes all BuddyPress users visible immediately on user creation and retroactively adjust users to allow for their display before logging in.
Author: Aaron Brazell
Version: 1.0
Author URI: http://technosailor.com
License: MIT
License URI: http://opensource.org/licenses/MIT
<?php
/*
Plugin Name: Pop Up Once
Plugin URI: https://gist.github.com/4394411
Description: Quick plugin to create a modal popup form
Author: Aaron Brazell
Author URI: http://technosailor.com
Version: 1.0
*/
<?php
/*
Plugin Name: Test
*/
class My_Like_Button {
function __construct()
{
$this->hooks();
}
<!--- Start : Ajax Auto Complete --->
<script type="text/javascript" src="js/jquery.js"></script>
<script type='text/javascript' src='js/jquery.autocomplete.js'></script>
<link rel="stylesheet" type="text/css" href="css/jquery.autocomplete.css" />
<script type="text/javascript">
$(document).ready(function() {
$("#CountryName").autocomplete("get_countries_list.php", {
width: 260,
matchContains: true,