This file contains 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
/** | |
* [ic_categories] | |
* Muestra Categorías con imagen, título y descripción en cada categoría | |
*/ | |
function ic_categories_shortcode( $atts, $content = null ) { | |
ob_start(); | |
$taxonomies = array( 'category' ); | |
$terms = get_terms( $taxonomies ); |
This file contains 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 | |
/** | |
* Plugin Name: Boton | |
* Description: Un ejemplo de shortcode | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) exit; | |
/** | |
* Crea shortcode [boton] | |
* [boton]texto[/boton] |
This file contains 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
function custom_devent_speaker_meta_fields( $fields ) { | |
$fields['devent_speaker_tumblr'] = array( | |
'name' => __( 'Tumblr:' , 'devent' ), | |
'description' => '', | |
'type' => 'url', | |
'default' => '', | |
); | |
return $fields; |
This file contains 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
global $post; | |
$devent_speaker_tumblr = get_post_meta( $post->ID, 'devent_speaker_tumblr' ); | |
if ( $devent_speaker_tumblr ) { | |
echo $devent_speaker_tumblr[0]; | |
} |
This file contains 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
jQuery(document).ready(function($) { | |
var form = $( "#form-encuesta" ); | |
jQuery.validator.setDefaults({ | |
debug: false, | |
success: "valid" | |
}); | |
jQuery.extend(jQuery.validator.messages, { |
This file contains 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
/** | |
* creamos la variable ajaxurl y la imprimimos en el head | |
*/ | |
function encuesta_crea_ajaxurl() { ?> | |
<script type="text/javascript"> | |
var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>"; | |
</script> | |
<?php } | |
add_action('wp_head','encuesta_crea_ajaxurl'); |
This file contains 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 | |
/** | |
* crea registro con datos desde el formulario | |
*/ | |
function encuesta_ajax() { | |
$result['type'] = 'success'; | |
$result['msg'] = 'testeando...'; | |
$result = json_encode( $result ); | |
echo $result; | |
wp_die(); |
This file contains 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
... | |
<input class="submit-button" type="submit" value="Enviar"> | |
<?php wp_nonce_field( 'encuesta_action', 'encuesta_nonce_field' ); ?> | |
</form> | |
</div> |
This file contains 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 | |
/** | |
* crea registro con datos desde el formulario | |
*/ | |
function encuesta_ajax() { | |
// verifica nonce | |
if ( ! isset( $_POST['encuesta_nonce_field'] ) || ! wp_verify_nonce( $_POST['encuesta_nonce_field'], 'encuesta_action' ) ) { |
This file contains 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 | |
/** | |
* [encuesta] | |
* Imprime la aplicación encuesta | |
*/ | |
function encuesta_shortcode( $atts, $content = null ) { | |
global $encuesta_atts; | |
$encuesta_atts = shortcode_atts( array(), $atts ); |