Skip to content

Instantly share code, notes, and snippets.

View agustinprosperi's full-sized avatar

Agustin Prosperi agustinprosperi

View GitHub Profile
@agustinprosperi
agustinprosperi / ipn-test.php
Last active September 21, 2015 10:15 — forked from mikejolley/ipn-test.php
Quick snippet/plugin/dropin to test IPN support
<?php
/**
* Plugin Name: PayPal Sandbox IPN Tester
* Description: Pings the IPN endpoint to see if your server can connect. Just head to <a href="/?ipn-test=1">yoursite.com/?ipn-test=1</a> whilst logged in as admin.
* Version: 1.0.0
* Author: WooThemes
* Requires at least: 4.1
* Tested up to: 4.3
*/
if ( ! defined( 'ABSPATH' ) ) {
@agustinprosperi
agustinprosperi / woocommerce-composites-wpml-fix.php
Last active September 1, 2015 10:02
If you are using WPML with WooCommerce Multilingual, WooCommerce & Composite Products and get an error when attempting to add a Composite to your cart, this snippet might fix the issue.
<?php
/**
* Plugin Name: WooCommerce Composite Products - WPML Cart Error Fix
* Plugin URI: http://www.woothemes.com/products/composite-products/
* Description: If you are using WPML with WooCommerce Multilingual, WooCommerce & Composite Products and get an error when attempting to add a Composite to your cart, this snippet might fix the issue.
* Version: 1.1
* Author: Manos Psychogyiopoulos
* Author URI: http://www.somewherewarm.net/
*
* Requires at least: 3.8
@mixin box-shadow($top, $left, $blur, $color, $inset: false) {
@if $inset {
-webkit-box-shadow:inset $top $left $blur $color;
-moz-box-shadow:inset $top $left $blur $color;
box-shadow:inset $top $left $blur $color;
} @else {
-webkit-box-shadow: $top $left $blur $color;
-moz-box-shadow: $top $left $blur $color;
box-shadow: $top $left $blur $color;
}
@agustinprosperi
agustinprosperi / default_mixins.sass
Last active October 20, 2015 15:37
default_mixins
// Mixins
// border radius
=border-radius($radius)
-webkit-border-radius: $radius
-moz-border-radius: $radius
-ms-border-radius: $radius
border-radius: $radius
// transition
=transition($v1...)
-webkit-transition: $v1
@agustinprosperi
agustinprosperi / custom_taxonomy_dropdown_in_admin.php
Last active September 1, 2015 10:25
Display a custom taxonomy dropdown in admin for posts or ctp
<?php
/**
* Display a custom taxonomy dropdown in admin
* @author Mike Hemberger
* @link http://thestizmedia.com/custom-post-type-filter-admin-custom-taxonomy/
*/
add_action('restrict_manage_posts', 'tsm_filter_post_type_by_taxonomy');
function tsm_filter_post_type_by_taxonomy() {
global $typenow;
$post_type = 'myctp'; // change to your post type
@-webkit-keyframes bgcolor { 0% { background-color: #ffccf2; }
50% { background-color: #ccffcc; }
100% { background-color: #ccffff; } }
@-moz-keyframes bgcolor { 0% { background-color: #ffccf2; }
50% { background-color: #ccffcc; }
100% { background-color: #ccffff; } }
@-ms-keyframes bgcolor { 0% { background-color: #ffccf2; }
50% { background-color: #ccffcc; }
<?php
/**
* get_youtube_videos_array();
* @vars what it says, a api_key is required you can get yours on https://console.developers.google.com/project
* @return array of youtube videos empty array if empty videos
*/
function get_youtube_videos_array($channelId='', $API_key='', $maxResults=''){
$channelId = ( empty($channelId) )? 'UCA2qz0MN4NxajgU7RYnifyg': $channelId;//
$API_key = ( empty($API_key) )? 'AIzaSyCJoNHWwvNxmfhcgtFoWDY0nzxn0T8wooE': $API_key;//'{YOUR_API_KEY}';
$maxResults = ( empty($maxResults) )? 3: $maxResults;
<?php
if (!isset($_GET['url'])) {
?>
<!DOCTYPE html>
<meta charset="utf-8">
<title>Youtube RSS creator</title>
<form>
<p>Create an RSS feed for the videos on the following page:
<p><input name="url" placeholder="E.g. https://www.youtube.com/user/scishow/videos" style="width: 30em">
@agustinprosperi
agustinprosperi / remove_editor_by_pages_id.php
Last active August 25, 2017 09:43
Remove content editor for some pages or posts by id or template name, wordpress
<?php
// sitioPageOptionID
function sitioPageOptionID(){
global $opgd;
if( empty($opgd) || empty($opgd->post_count) ){
//return 6;
$opgd = new WP_Query(array(
'post_type' => 'page',
'meta_key' => '_wp_page_template',
'meta_value' => 'template-options-gd.php',
@agustinprosperi
agustinprosperi / custom_get_related_posts.php
Last active August 29, 2015 14:21
custom get related posts by tags if not, by cat if not, from all, wordpress