Skip to content

Instantly share code, notes, and snippets.

@igmoweb
igmoweb / basic-comments.php
Last active August 29, 2015 14:06
Basic Comments
<?php
if ( post_password_required() )
return;
?>
<div id="comments" class="comments-area">
<?php if ( comments_open() && get_comments_number() ): ?>
@igmoweb
igmoweb / curso-fictizia-contact-form.php
Last active August 29, 2015 14:06
Formulario de contacto
<form action="" method="POST">
<p>
<label for="email"><?php _e( 'Email', 'ignacio' ); ?>
<input id="email" type="email" name="email" value="" />
</label>
</p>
<p>
<label for="message"><?php _e( 'Message', 'ignacio' ); ?></label>
<textarea id="message" name="message"></textarea>
</p>
@igmoweb
igmoweb / complete-woocommerce-setting-class.php
Created May 20, 2014 12:39
Woocommerce new setting class complete
<?php
class WC_Settings_Hola_Dolly extends WC_Settings_Page {
public function __construct() {
$this->id = 'hola-dolly';
$this->label = __( 'Hola Dolly', 'hola-dolly' );
// Añadir pestaña
add_filter( 'woocommerce_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
@igmoweb
igmoweb / display-textarea-woocommerce.php
Last active August 29, 2015 14:01
Display textarea in WooCommerce Settings
<?php
public function display_special_field( $field ) {
$option_value = get_option( $field['id'], $field['default'] );
?>
<label for="<?php echo $field['id']; ?>" ><?php echo esc_html( $field['title'] ); ?></label><br/>
<textarea name="<?php echo $field['id']; ?>" id="<?php echo $field['id']; ?>"><?php echo esc_textarea( $option_value ); ?></textarea>
<?php
@igmoweb
igmoweb / display-special-field-woocommerce.php
Last active August 29, 2015 14:01
Displaying new custom option in WooCommerce
<?php
class WC_Settings_Hola_Dolly extends WC_Settings_Page {
public function __construct() {
$this->id = 'hola-dolly';
$this->label = __( 'Hola Dolly', 'hola-dolly' );
// Añadir pestaña
add_filter( 'woocommerce_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
@igmoweb
igmoweb / custom-options-woocommerce.php
Created May 20, 2014 12:02
Adding custom options with WooCommerce Settings API
<?php
class WC_Settings_Hola_Dolly extends WC_Settings_Page {
public function __construct() {
$this->id = 'hola-dolly';
$this->label = __( 'Hola Dolly', 'hola-dolly' );
// Añadir pestaña
add_filter( 'woocommerce_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
@igmoweb
igmoweb / filter-being-executed.php
Created May 17, 2014 16:49
What filter is being executed
<?php $hook_name = current_filter(); ?>
@igmoweb
igmoweb / hooks-already-executed.php
Last active August 29, 2015 14:01
Check what hooks have been already executed
<?php
global $wp_actions;
var_dump($wp_actions);
@igmoweb
igmoweb / hook-ejecutado.php
Last active August 29, 2015 14:01
How to know if a hook has already been executed
<?php $hook_executed = did_action( 'init' ); ?>
@igmoweb
igmoweb / pinteres-embed.php
Created May 14, 2014 09:11
Pinteres Embeds
<?php
/**
* Plugin Name: Pinterest embeds
*/
class Pinterest_Embed {
public $embedded = false;