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 | |
/** | |
* Template Name: DocumentoEjemplo | |
* Version: 0.1 | |
* Description: | |
* Author: | |
* Author URI: | |
* Group: Grupo ejemplo |
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 filtro_personalizado_taxonomia() { | |
global $typenow; | |
// En el siguiente array añadimos la taxonomía que queremos mostrar. | |
// Hay que poner el slug de la taxonomía | |
$taxonomias = array('NOMBRE_TAXONOMIA'); | |
// Debemos seleccionar el tipo de post sobre el que se va a mostrar | |
if( $typenow == 'slug_del_tipo_de_post' ) | |
{ |
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
add_action('wp_logout','cerrar_sesion'); | |
function cerrar_sesion() | |
{ | |
wp_redirect("https://pagina a la que queramos redirigir..."); | |
exit(); | |
} |
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
add_shortcode('sc_redireccion_personalizada', 'redireccion_personalizada'); | |
function redireccion_personalizada() | |
{ | |
$usuario = new WP_User(get_current_user_id()); | |
if( $usuario && is_object( $usuario ) && is_a( $usuario, 'WP_User' ) ) | |
{ | |
switch ($usuario->roles[0]) | |
{ | |
case 'administrator': | |
$url = admin_url(); |
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
add_shortcode('productos_cliente', 'productos_cliente'); | |
//Declaramos un shortcode para poder mostrar el listado mediante [productos_cliente] | |
function productos_cliente($parametros) | |
{ | |
echo "Listado de productos comprados"; | |
// Obtenemos todos los pedidos del cliente | |
$pedidos = get_posts( array( | |
'numberposts' => -1, | |
'meta_key' => '_customer_user', |
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 add_login_logout_register_menu( $items, $args ) | |
{ | |
if ( $args->theme_location != 'secondary-menu' ) | |
{ | |
return $items; | |
} | |
if ( is_user_logged_in() ) | |
{ | |
$current_user = wp_get_current_user(); |
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
* { | |
border-radius: 0 !important; | |
} | |
* { | |
-webkit-border-radius: 0 !important; | |
-moz-border-radius: 0 !important; | |
border-radius: 0 !important; | |
} |
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
$thumb_id = get_post_thumbnail_id(); | |
$thumb_url = wp_get_attachment_image_src($thumb_id,'medium', true); | |
$url_imagen=$thumb_url[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
<?php | |
$args=array('post_type' => 'product', | |
'post_status' => 'publish', | |
'posts_per_page' => '3', | |
'orderby' => 'date', | |
'order' => 'DESC' | |
); | |
$posts = null; | |
$posts = new WP_Query($args); | |
if( $posts->have_posts() ) |