-
-
Hola a todos, estamos instalando el plugin dynamic headers en el tema twenty twelve. Lo que nos falta es añadir el código que da el plugin en el header.php de nuestro tema, y necesitamos saber en que parte del código pegarlo.
Éste es nuestro header.php:
<?php
/**
* The Header for our theme.
*
* Displays all of the <head> section and everything up till <div id=»main»>
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
?><!DOCTYPE html>
<!–[if IE 7]>
<html class=»ie ie7″ <?php language_attributes(); ?>>
<![endif]–>
<!–[if IE 8]>
<html class=»ie ie8″ <?php language_attributes(); ?>>
<![endif]–>
<!–[if !(IE 7) | !(IE 8) ]><!–>
<html <?php language_attributes(); ?>>
<!–<![endif]–>
<head>
<meta charset=»<?php bloginfo( ‘charset’ ); ?>» />
<meta name=»viewport» content=»width=device-width» />
<title><?php wp_title( ‘|’, true, ‘right’ ); ?></title>
<link rel=»profile» href=»http://gmpg.org/xfn/11″ />
<link rel=»pingback» href=»<?php bloginfo( ‘pingback_url’ ); ?>» />
<?php // Loads HTML5 JavaScript file to add support for HTML5 elements in older IE versions. ?>
<!–[if lt IE 9]>
<script src=»<?php echo get_template_directory_uri(); ?>/js/html5.js» type=»text/javascript»></script>
<![endif]–>
<?php wp_head(); ?>
</head><body <?php body_class(); ?>>
<div id=»page» class=»hfeed site»>
<header id=»masthead» class=»site-header» role=»banner»>
<hgroup>
<h1 class=»site-title»>» title=»<?php echo esc_attr( get_bloginfo( ‘name’, ‘display’ ) ); ?>» rel=»home»><?php bloginfo( ‘name’ ); ?></h1>
<h2 class=»site-description»><?php bloginfo( ‘description’ ); ?></h2>
</hgroup><nav id=»site-navigation» class=»main-navigation» role=»navigation»>
<h3 class=»menu-toggle»><?php _e( ‘Menu’, ‘twentytwelve’ ); ?></h3>
«><?php _e( ‘Skip to content’, ‘twentytwelve’ ); ?>
<?php wp_nav_menu( array( ‘theme_location’ => ‘primary’, ‘menu_class’ => ‘nav-menu’ ) ); ?>
</nav><!– #site-navigation –><?php $header_image = get_header_image();
if ( ! empty( $header_image ) ) : ?>
«><img src=»<?php echo esc_url( $header_image ); ?>» class=»header-image» width=»<?php echo get_custom_header()->width; ?>» height=»<?php echo get_custom_header()->height; ?>» alt=»» />
<?php endif; ?>
</header><!– #masthead –><div id=»main» class=»wrapper»>
Y éste el código que tenemos que añadir:
<?php
if(function_exists(‘show_media_header’)){
show_media_header();
}
?>Muchas gracias de antemano
Saludos
-
Buenas,
HE estado revisando mensajes y el codex y no encuentro mi error. A ver si alguien puede ayudarmeHe creado un plugin para hacer un nuevo CUSTOM POST TYPE.
este es el código:
<?php /* Plugin Name: POPUP CUSTOM TYPE */ add_action('init', 'popup_custom_type'); function popup_custom_type(){ register_post_type('popup_custom_type', array( 'labels' => array( 'name' => 'Popup Custom type', 'menu_name' => 'Popup Posts'), 'singular_label' => 'Popup Custom Type', 'public' => true, 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => false, 'show_in_menu' => true, 'supports' => array( 'title', 'editor', 'author', 'revisions', 'comments') ) ); } ?>
He creado una plantilla, que se llama single-custom_post_type.php con esta llamada:
<?php $query = array( 'post_type' => 'popup_custom_type', 'showposts' => 1, 'post_status' => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', 'trash') ); query_posts($query); if (have_posts()) : while (have_posts()) : the_post(); ?> <?php the_content(); ?> <?php endwhile; else: endif; ?>
Y posteriormente he creado mi custom post type, cuando pre-visualizo en versión draft, me aparece perfectamente, con estilos y todo. Pero cuando publico, nada, me sale este error:
Sorry, no posts matched your criteria.¿Alguien sabe qué puede estar pasando???
Graciass
-
Buenas,
HE estado revisando mensajes y el codex y no encuentro mi error. A ver si alguien puede ayudarmeHe creado un plugin para hacer un nuevo CUSTOM POST TYPE.
este es el código:
<?php /* Plugin Name: POPUP CUSTOM TYPE */ add_action('init', 'popup_custom_type'); function popup_custom_type(){ register_post_type('popup_custom_type', array( 'labels' => array( 'name' => 'Popup Custom type', 'menu_name' => 'Popup Posts'), 'singular_label' => 'Popup Custom Type', 'public' => true, 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => false, 'show_in_menu' => true, 'supports' => array( 'title', 'editor', 'author', 'revisions', 'comments') ) ); } ?>
He creado una plantilla, que se llama single-custom_post_type.php con esta llamada:
<?php $query = array( 'post_type' => 'popup_custom_type', 'showposts' => 1, 'post_status' => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', 'trash') ); query_posts($query); if (have_posts()) : while (have_posts()) : the_post(); ?> <?php the_content(); ?> <?php endwhile; else: endif; ?>
Y posteriormente he creado mi custom post type, cuando pre-visualizo en versión draft, me aparece perfectamente, con estilos y todo. Pero cuando publico, nada, me sale este error:
Sorry, no posts matched your criteria.¿Alguien sabe qué puede estar pasando???
Graciass
-
Buenas,
HE estado revisando mensajes y el codex y no encuentro mi error. A ver si alguien puede ayudarmeHe creado un plugin para hacer un nuevo CUSTOM POST TYPE.
este es el código:
<?php /* Plugin Name: POPUP CUSTOM TYPE */ add_action('init', 'popup_custom_type'); function popup_custom_type(){ register_post_type('popup_custom_type', array( 'labels' => array( 'name' => 'Popup Custom type', 'menu_name' => 'Popup Posts'), 'singular_label' => 'Popup Custom Type', 'public' => true, 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => false, 'show_in_menu' => true, 'supports' => array( 'title', 'editor', 'author', 'revisions', 'comments') ) ); } ?>
He creado una plantilla, que se llama single-custom_post_type.php con esta llamada:
<?php $query = array( 'post_type' => 'popup_custom_type', 'showposts' => 1, 'post_status' => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', 'trash') ); query_posts($query); if (have_posts()) : while (have_posts()) : the_post(); ?> <?php the_content(); ?> <?php endwhile; else: endif; ?>
Y posteriormente he creado mi custom post type, cuando pre-visualizo en versión draft, me aparece perfectamente, con estilos y todo. Pero cuando publico, nada, me sale este error:
Sorry, no posts matched your criteria.¿Alguien sabe qué puede estar pasando???
Graciass
-
Buenas noches,
Mi problema es el siguiente:
En la página principal de mi sitio ( http://www.eyesa.es ) tengo una zona a la derecha donde se muestran los títulos de los 4 últimos posts del blog y se enlaza cada título con el contenido o la entrada completa de esa noticia. Ese enlace lleva a otra página del sitio mediante el siguiente código:
<?php require('./blog/wp-blog-header.php'); ?> <?php query_posts('showposts=4');?> <?php while (have_posts()) : the_post(); ?> <?php $id = get_the_ID(); ?> <li><a>" target="_blank"><?php the_title(); ?></a></li> <?php endwhile;?>
Sin embargo, al mostrar la entrada en el propio sitio web en lugar de en el blog, las fotografías se descuadran, las miniaturas de Youtube no aparecen y la imagen destacada que se puede meter en wordpress tampoco aparece.
Tengo dos preguntas:
1) Existe alguna forma de hacer que en la pagina web se vea tal cual como en el blog, con los plugins de youtube y con las fotos con su formato? Tal vez con algun require en php?
2) En el caso de que no pueda mostrarlo en la pagina web y tenga que hacer el enlace directamente a la entrada del blog, ¿Cómo puedo reescribir el código? Es decir, ¿a dónde pongo el link en a href? He probado a poner
<?php require('./blog/wp-blog-header.php'); ?> <?php query_posts('showposts=4');?> <?php while (have_posts()) : the_post(); ?> <?php $id = get_the_ID(); ?> <li><strong><a>" target="_blank"></a></strong><?php the_title(); ?></li> <?php endwhile;?>
3) Desde el punto de vista de SEO, es mejor mostrar el contenido en tu propia sitio web o en el blog (aunque por otra parte, el blog está dentro del propio sitio web…)
Gracias anticipadas.
Saludos
-
Hi amigos.. estoy armando un sitio web con un blog wordpress, mediante wp-load pongo un post recientes en mi página index (fuera de wordpress….) bueno, el hecho es que ya he usado este codigo y funciona, pero esta vez no entiendo porque no funciona.. he buscado la respuesta en todas partes y me doy por vencido.. tal vez ustedes me puedan ayudar el codigo en el index.html es…
<div id=”ultpot”>
<h3>Ultimos Post</h3>
<?php
require (‘blog/wp-load.php’) ?>
<?php query_posts(‘showposts=4′);
while (have_posts()) : the_post(); ?>
<div>
<h2>”><?php the_title(); ?></h2>
<?php if ( has_post_thumbnail() ) { the_post_thumbnail( ‘homepage-thumb’ ); } ?>
<?php the_excerpt(); ?>
</div>
<?php endwhile; wp_reset_query(); ?>
</div>la ruta que uso en el require es correcta pues wordpress esta instalado en el directorio blog a la misma altura de index.html.. les digo que he usado el codigo antes y funcion y no se porque aqui no…
alguien que sepa..?
gracias
-
Hola, he mirado en el foro posibles soluciones, las he aplicado pero no me funcionan.
Estoy haciendo una pagina, y necesito ordenar unos posts que pertenezcan a 2 categorias concretas, para ello, busqué por ahí, y tengo que usar el category__and. Hasta ahí perfecto.
El problema es que si uso category__and los post no se ordenan del mas reciente al mas viejo, sino que se ordena por fecha de creación, el primer post creado el primero y el último al final.
CÓDIGO USADO
NOTA: sobre el tema Infocus. Ellos dicen que pregunte aquí:
http://mysitemyway.com/support/topic/blog_list-order#post-110728CATEGORY__IN = FUNCIONA:
if( trim( $pagination ) == 'true' ) { $paged = mysite_get_page_query(); $blog_query->query(array( 'post__in' => $post_in, 'category__in' => $category_in, 'tag__in' => $tag_in, 'post_type' => 'post', 'posts_per_page' => $showposts, 'paged' => $paged, 'offset' => $offset, 'ignore_sticky_posts' => 1, 'orderby' => 'date', 'order' => 'DESC', )); } else { $blog_query->query(array( 'post__in' => $post_in, 'category__in' => $category_in, 'tag__in' => $tag_in, 'post_type' => 'post', 'showposts' => $showposts, 'nopaging' => 0, 'offset' => $offset, 'ignore_sticky_posts' => 1, 'orderby' => 'date', 'order' => 'DESC', )); }
CATEGORY__AND = NO FUNCIONA
if( trim( $pagination ) == 'true' ) { $paged = mysite_get_page_query(); $blog_query->query(array( 'post__in' => $post_in, 'category__and' => $category_in, 'tag__in' => $tag_in, 'post_type' => 'post', 'posts_per_page' => $showposts, 'paged' => $paged, 'offset' => $offset, 'ignore_sticky_posts' => 1, 'orderby' => 'date', 'order' => 'DESC', )); } else { $blog_query->query(array( 'post__in' => $post_in, 'category__and' => $category_in, 'tag__in' => $tag_in, 'post_type' => 'post', 'showposts' => $showposts, 'nopaging' => 0, 'offset' => $offset, 'ignore_sticky_posts' => 1, 'orderby' => 'date', 'order' => 'DESC', )); }
Si uso category__in se ordenan bien, si uso category__and, da igual como lo ordene que el orden es el de la fecha de la creación
-
Buenas a todos/as estoy utilizando el theme Brunelleschi. El problema que tengo es que no me deja colocar imagen de cabecera. La coloco en Header, la veo en vista previa, pero no puedo verla en la página real. La página es http://pruebablogemi.netii.net/
Este es header.php
<!doctype html>
<!–[if lt IE 7]> <html class=»no-js ie6 lt-ie9 lt-ie8 lt-ie7″ <?php echo language_attributes(); ?>> <![endif]–>
<!–[if IE 7]> <html class=»no-js ie7 lt-ie9 lt-ie8″ <?php echo language_attributes(); ?>> <![endif]–>
<!–[if IE 8]> <html class=»no-js ie8 lt-ie9″ <?php echo language_attributes(); ?>> <![endif]–>
<!–[if gt IE 8]><!–> <html class=»no-js» <?php echo language_attributes(); ?>> <!–<![endif]–>
<head>
<meta charset=»<?php bloginfo( ‘charset’ ); ?>» />
<meta http-equiv=»X-UA-Compatible» content=»IE=edge,chrome=1″>
<meta name=»viewport» content=»width=device-width»>
<title><?php brunelleschi_title(); ?></title>
<link rel=»profile» href=»http://gmpg.org/xfn/11″ />
<link rel=»pingback» href=»<?php bloginfo( ‘pingback_url’ ); ?>» />
<style type=»text/css»> #wrapper { max-width: <?php echo brunelleschi_options(‘content-width’); ?>px !important;} </style>
<?php
if ( is_singular() && get_option( ‘thread_comments’ ) )
wp_enqueue_script( ‘comment-reply’ );
wp_head();
?>
<style><?php if(brunelleschi_options(‘extra-css’)){ echo brunelleschi_options(‘extra-css’); }?></style>
</head>
<body <?php body_class(); ?>>
<div id=»wrapper» class=»hfeed container»>
<header id=»header» class=»row clearfix»>
<?php if( (brunelleschi_options(‘header-order’) === __(‘Text on Top’,’brunelleschi’) || brunelleschi_options(‘header-order’) === __(‘Text on the Left’,’brunelleschi’) || ! brunelleschi_options(‘header-order’)) && !(brunelleschi_options(‘navigation-position’) === __(‘Nav Above Banner’,’brunelleschi’) && brunelleschi_options(‘header-order’) === __(‘Text on the Left’,’brunelleschi’)) ) : ?>
<hgroup id=»branding» class=»<?php brunelleschi_branding_class(); ?>»>
<h1 class=»site-title»>» title=»<?php echo esc_attr( get_bloginfo( ‘name’, ‘display’ ) ); ?>» rel=»home»><?php bloginfo( ‘name’ ); ?></h1>
<h2 class=»site-description»><?php bloginfo( ‘description’ ); ?></h2>
</hgroup>
<?php endif; ?>
<?php if(!brunelleschi_options(‘hide-navigation’) && brunelleschi_options(‘navigation-position’) === __(‘Nav Above Banner’,’brunelleschi’)): ?>
<div id=»access» role=»navigation» class=»twelvecol last clearfix»>
<div class=»skip-link screen-reader-text»>«><?php _e( ‘Skip to content’, ‘brunelleschi’ ); ?></div>
<?php wp_nav_menu( array( ‘container_class’ => ‘menu-header’, ‘theme_location’ => ‘primary’ ) ); ?>
</div><!– #access –>
<?php endif; ?>
<?php if( brunelleschi_options(‘navigation-position’) === __(‘Nav Above Banner’,’brunelleschi’) && ( brunelleschi_options(‘header-order’) === __(‘Text on the Left’,’brunelleschi’) || ! brunelleschi_options(‘header-order’) )) : ?>
<hgroup id=»branding» class=»<?php brunelleschi_branding_class(); ?>»>
<h1 class=»site-title»>» title=»<?php echo esc_attr( get_bloginfo( ‘name’, ‘display’ ) ); ?>» rel=»home»><?php bloginfo( ‘name’ ); ?></h1>
<h2 class=»site-description»><?php bloginfo( ‘description’ ); ?></h2>
</hgroup>
<?php endif; ?>
<?php if(brunelleschi_options(‘use-featured-content’)): ?>
<?php get_template_part( ‘featured’, ‘content’ ); ?>
<?php elseif(brunelleschi_options(‘use-header-image’)) : ?>
<?php
// Check if this is a post or page, if it has a thumbnail, and if it’s a big one
if ( is_singular() && current_theme_supports( ‘post-thumbnails’ ) &&
has_post_thumbnail( $post->ID ) &&
( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘post-thumbnail’ ) ) &&
$image[1] >= HEADER_IMAGE_WIDTH ) :
// Houston, we have a new header image!
echo get_the_post_thumbnail( $post->ID, array( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT ), array( ‘id’ => ‘headerimg’) );
elseif ( get_header_image() ) : ?>
» class=»<?php brunelleschi_banner_class(); ?>» title=»<?php echo esc_attr( get_bloginfo( ‘name’, ‘display’ ) ); ?>» rel=»home»>
<img src=»<?php header_image(); ?>» alt=»» id=»headerimg» />
<?php endif; ?>
<?php endif; ?>
<?php if(brunelleschi_options(‘header-order’) === __(‘Text on the Bottom’,’brunelleschi’) || brunelleschi_options(‘header-order’) === __(‘Text on the Right’,’brunelleschi’)) : ?>
<hgroup id=»branding» class=»<?php brunelleschi_branding_class(); ?>»>
<h1 class=»site-title»>» title=»<?php echo esc_attr( get_bloginfo( ‘name’, ‘display’ ) ); ?>» rel=»home»><?php bloginfo( ‘name’ ); ?></h1>
<h2 class=»site-description»><?php bloginfo( ‘description’ ); ?></h2>
</hgroup>
<?php endif; ?>
<?php if((brunelleschi_options(‘navigation-position’)) == false || !brunelleschi_options(‘hide-navigation’) && brunelleschi_options(‘navigation-position’) === __(‘Nav Below Banner’,’brunelleschi’)): ?>
<div id=»access» role=»navigation» class=»twelvecol last clearfix»>
<div class=»skip-link screen-reader-text»>«><?php _e( ‘Skip to content’, ‘brunelleschi’ ); ?></div>
<?php wp_nav_menu( array( ‘container_class’ => ‘menu-header’, ‘theme_location’ => ‘primary’ ) ); ?>
</div><!– #access –>
<?php endif; ?>
</header><!– #header –>
<div id=»container» class=»row clearfix»>¿A qué se debe?
Muchas gracias.
Saludos
-
hola, me llamo Daniel P Z, quisiera agredecer a cualquier persona que se tome el tiempo de leer mi post y poder ayudarme en él;
Tengo un problema, declarando un Class, en el Div del comienzo de un post, dentro del loop, (wuau si lee este último enunciado alguien que no sepa wordpress se pierde al instante)
Bueno sigue, les explico,En mi archivo index.php, mi loop para generar los post es el siguiente;
<?php $recent = new WP_Query("cat=58&showposts=4"); while($recent->have_posts()) : $recent->the_post();?> <div class="wrapper p1"> <figure class="img-indent4"><?php the_post_thumbnail('medium'); ?></figure> <div class="extra-wrap"> <div class="date"> <?php the_time(get_option('date_format')); ?> </div> " href="<?php the_permalink() ?>"><?php the_title(); ?>. </div> </div> <?php endwhile;?>
El problema es el siguiente,, ; quisiera cambiarle el class cuando me muestre el post numero 4, y como mis conocimientos limitados de wordpress aun no me permiten, me descargue un pack de más de 400 plantillas de wordpress y en los ejemplos que pude sacar pude sacar un code para transformarlo de esta forma;
<?php $recent = new WP_Query("cat=58&showposts=4"); while($recent->have_posts()) : $recent->the_post();?> <?php $count = 0; ?> <div class="wrapper p1"> <figure class="img-indent4"><?php the_post_thumbnail('medium'); ?></figure> <div class="extra-wrap"> <div class="date"> <?php the_time(get_option('date_format')); ?> </div> " href="<?php the_permalink() ?>"><?php the_title(); ?>. </div> </div> <?php if (++$counter % 3 == 0) { echo "<div class='wrapper prev-indent-bot'><figure class='img-indent4'>the_post_thumbnail('medium');</figure><div class='extra-wrap'><div class='date'>October 28th, 2010</div>Set dolor ser adipiscing elit sed diam nonummy.</div></div>"; }?> <?php endwhile;?>
Lo que se tendria que cambiar en el cuarto post es de;
<div class="wrapper p1">
a
<div class='wrapper prev-indent-bot'>
Como podria lograr eso?
-