Skip to content

Instantly share code, notes, and snippets.

@eduardozulian
eduardozulian / wp-taxonomy-dropdown.php
Last active May 5, 2024 14:45
Callback function for 'meta_box_cb' argument inside register_taxonomy() that replaces the regular checkboxes with a plain dropdown list
<?php
/**
* Callback function for taxonomy meta boxes
*
* A simple callback function for 'meta_box_cb' argument
* inside register_taxonomy() that replaces the regular
* checkboxes with a plain dropdown list
*
* @param [type] $post [description]
* @param [type] $box [description]
@eduardozulian
eduardozulian / _social-colors.scss
Created December 2, 2014 16:52
Social media colors presented as Sass variables. http://sass-lang.com
$color-dribbble: #ea4c89;
$color-facebook: #3b5998;
$color-flickr: #ff0084;
$color-googleplus: #dd4b39;
$color-instagram: #517fa4;
$color-linkedin: #007bb6;
$color-pinterest: #cb2027;
$color-tumblr: #32506d;
$color-twitter: #00aced;
$color-vimeo: #1ab7ea;
@eduardozulian
eduardozulian / plugin-init.php
Created December 19, 2013 20:45
WordPress plugin initialization
<?php
/*
Plugin Name:
Plugin URI:
Description:
Version: 0.1
Author: Eduardo Zulian
Author URI:
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@eduardozulian
eduardozulian / readme.txt
Last active December 29, 2015 10:39
My WordPress plugins readme standard
=== PLUGIN_NAME ===
Contributors: eduardozulian
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=H28V8F5PHSZHA
Tags:
Requires at least: 3.0
Tested up to: 3.8
Stable tag: 1.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@eduardozulian
eduardozulian / wp-get-attachment-id.php
Created September 30, 2013 13:24
Retrieve the attachment ID from the file URL
<?php
/**
* Retrieve the attachment ID from the file URL
*
* @link http://pippinsplugins.com/retrieve-attachment-id-from-image-url/
*/
function horizonte_rural_get_attachment_id( $image_url ) {
global $wpdb;
$attachment = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM " . $wpdb->posts . " WHERE guid='%s';", $image_url ) );
@eduardozulian
eduardozulian / wp-taxonomy-checkbox.php
Created September 24, 2013 13:31
Use checkbox term selection for non-hierarchical taxonomies.
<?php
// Change this to your own taxonomy and post type
new Tag_Checklist( 'taxonomy_name', 'post_type' );
/**
* Use checkbox term selection for non-hierarchical taxonomies
*
* @author Hugh Lashbrooke
@eduardozulian
eduardozulian / wp-get-image-sizes.php
Created September 6, 2013 18:23
Get all the registered image sizes along with their dimensions
<?php
/**
* Get all the registered image sizes along with their dimensions
*
* @global array $_wp_additional_image_sizes
*
* @link http://core.trac.wordpress.org/ticket/18947 Reference ticket
* @return array $image_sizes The image sizes
*/
function _get_all_image_sizes() {
@eduardozulian
eduardozulian / wp-featured-video.php
Last active January 5, 2016 21:58
Create a custom field with the first embed URL found in a post format video. Can be used for featuring a video wherever is necessary.
@eduardozulian
eduardozulian / widget-posts-from-category.php
Last active December 14, 2015 06:19
Widget that displays the latest WordPress posts from a certain category / Widget que mostra os últimos posts de uma determinada categoria
<?php
/**
* Cria o Widget que mostra os posts da categoria selecionada
*
*/
class Recent_Category_Posts extends WP_Widget {
/**
* Constructor
*
@eduardozulian
eduardozulian / wp-customize-image-reloaded.php
Last active November 16, 2023 02:50
Extend WP_Customize_Image_Control class allowing access to files uploaded within the same context.
<?php
/**
* Customize Image Reloaded Class
*
* Extend WP_Customize_Image_Control allowing access to uploads made within
* the same context
*/
class My_Customize_Image_Reloaded_Control extends WP_Customize_Image_Control {
/**
* Constructor.