This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function update( $new_instance, $old_instance ) { | |
$instance = $old_instance; | |
$title = sanitize_text_field( $new_instance['title'] ); | |
if ( ! empty( $title ) ) | |
$instance['title'] = $title; | |
return $instance; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function widget( $args, $instance ) { | |
$title = apply_filters( 'widget_title', $instance['title'] ); | |
?> | |
<?php echo $args['before_widget']; ?> | |
<?php if ( $title ) | |
echo $args['before_title'] . $title . $args['after_title']; ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function widget( $args, $instance ) { | |
extract( $args ); | |
$title = apply_filters( 'widget_title', $instance['title'] ); | |
?> | |
<?php echo $before_widget; ?> | |
<?php if ( $title ) | |
echo $before_title . $title . $after_title; ?> | |
Hola, mundo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Fictizia_Widget extends WP_Widget { | |
// El nombre de la clase tiene que coincidir con esta función | |
function Fictizia_Widget() { | |
// Argumentos | |
$args = array( 'classname' => 'fictizia-widget', 'description' => __( 'Fictizia Widget Description', 'fictizia' ) ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $wpdb; | |
$tablename = $wpdb->prefix . 'fictizia_clientes'; | |
$charset_collate = ''; | |
if ( ! empty($wpdb->charset) ) | |
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; | |
if ( ! empty($wpdb->collate) ) | |
$charset_collate .= " COLLATE $wpdb->collate"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action="" method="POST"> | |
<table class="form-table"> | |
<tr> | |
<th scope="row"><?php _e( 'New customer', 'fictizia' ); ?></th> | |
<td> | |
<input type="text" name="cliente" value=""/> | |
</td> | |
</tr> | |
</table> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'admin_menu', 'fictizia_add_settings_menu' ); | |
function fictizia_add_settings_menu() { | |
add_submenu_page( 'fictizia-main', 'Settings', 'Settings', 'manage_options', 'fictizia-settings', 'fictizia_display_settings_menu' ); | |
} | |
function fictizia_settings_init() { | |
register_setting( 'OPTIONS_GROUP', 'OPTIONS_GROUP', 'SANITIZE_CALLBACK' ); | |
add_settings_section( 'SECTION_ID', __( 'SECTION_TITLE', 'fictizia' ), 'SECTION_CALLBACK', 'MENU_SLUG' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_ajax_fictizia_load_posts', 'fictizia_load_posts' ); | |
add_action( 'wp_ajax_nopriv_fictizia_load_posts', 'fictizia_load_posts' ); | |
function fictizia_load_posts() { | |
$posts = // SELECCIONAMOS LOS POSTS | |
wp_send_json( $posts ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<phpunit | |
bootstrap="tests/bootstrap.php" | |
backupGlobals="false" | |
colors="true" | |
convertErrorsToExceptions="true" | |
convertNoticesToExceptions="true" | |
convertWarningsToExceptions="true" | |
> | |
<php> | |
<const name="WP_TESTS_MULTISITE" value="1" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_head', 'dolly_print_styles' ); | |
function dolly_print_styles() { | |
$options = get_option( 'my-options' ); | |
?> | |
<style> | |
.my-class { | |
background-color:<?php echo $options['background-color']; ?>; | |
font-size:<?php echo $options['font-size']; ?>px; | |
} |