Foros del Web » Programando para Internet » PHP »

Necesito modificar este PHP

Estas en el tema de Necesito modificar este PHP en el foro de PHP en Foros del Web. Hola. Bueno resulta que mi web tiene la opción de un blog aparte de la pagina principal, lo que quiero hacer es modificar ese parte ...
  #1 (permalink)  
Antiguo 17/12/2012, 20:37
 
Fecha de Ingreso: noviembre-2012
Mensajes: 67
Antigüedad: 11 años, 5 meses
Puntos: 1
Pregunta Necesito modificar este PHP

Hola.

Bueno resulta que mi web tiene la opción de un blog aparte de la pagina principal, lo que quiero hacer es modificar ese parte "blog" para hacer que solo aparezcan una serie de categorías que en este caso seria (17,18,19,20,21,82).

Aquí les dejo el PHP, la verdad es que no se como hacerlo, por eso pido esta ayuda, que espero me den resultados... Gracias desde ya

Código PHP:
<?php
/*
    Template Name: Blog
*/
?>
<?php get_header
(); ?>

<div id="left">
    <?php
    $temp 
$wp_query;
    
$wp_querynull;
    
$wp_query = new WP_Query();
    
$wp_query->query('paged='.$paged);
    
?>
    <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
        
        <div class="post" id="post-<?php the_ID(); ?>">
            <div class="title">
                <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
                <div class="postmeta">     <span>Posted by <?php the_author_posts_link(); ?></span> | <span><?php the_time('l, n F Y'); ?></span> | <span><?php the_category(', '); ?></span> </div>
            </div>

            <div class="entry">
                <?php the_post_thumbnail'story_feature', array('class' => 's-image') ); ?>
                <?php wpe_excerpt('wpe_excerptlength_archive'''); ?>
                <div class="clear"></div>
            </div>
        </div>

    <?php endwhile; ?>

    <?php getpagenavi(); ?>
    
    <?php $wp_query null$wp_query $temp;?>    
                
</div>

<?php get_sidebar(); ?>
<?php get_footer
(); ?>
  #2 (permalink)  
Antiguo 17/12/2012, 21:01
 
Fecha de Ingreso: noviembre-2007
Ubicación: Etzatlan, Jalisco
Mensajes: 50
Antigüedad: 16 años, 4 meses
Puntos: 18
Respuesta: Necesito modificar este PHP

Que tal amigo, no estoy muy seguro, pero creo que debería de quedar así :D Prueba y me comentas :D

Código PHP:
 <?php
/*
    Template Name: Blog
*/
?>
<?php get_header
(); ?>

<div id="left">
    <?php
    $temp 
$wp_query;
    
$wp_querynull;
    
$wp_query = new WP_Query();
    
$wp_query->query('paged='.$paged);
    
?>
    <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    
        <?php if((the_ID() <= 21 && the_ID() >= 17) || the_ID() == 82) {?>
        
        <div class="post" id="post-<?php the_ID(); ?>">
            <div class="title">
                <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
                <div class="postmeta">     <span>Posted by <?php the_author_posts_link(); ?></span> | <span><?php the_time('l, n F Y'); ?></span> | <span><?php the_category(', '); ?></span> </div>
            </div>

            <div class="entry">
                <?php the_post_thumbnail'story_feature', array('class' => 's-image') ); ?>
                <?php wpe_excerpt('wpe_excerptlength_archive'''); ?>
                <div class="clear"></div>
            </div>
        </div>
    <?php ?>
    <?php endwhile; ?>

    <?php getpagenavi(); ?>
    
    <?php $wp_query null$wp_query $temp;?>    
                
</div>

<?php get_sidebar(); ?>
<?php get_footer
(); ?>
  #3 (permalink)  
Antiguo 18/12/2012, 07:39
 
Fecha de Ingreso: noviembre-2012
Mensajes: 67
Antigüedad: 11 años, 5 meses
Puntos: 1
Respuesta: Necesito modificar este PHP

Cita:
Iniciado por anarkes Ver Mensaje
Que tal amigo, no estoy muy seguro, pero creo que debería de quedar así :D Prueba y me comentas :D

Código PHP:
 <?php
/*
    Template Name: Blog
*/
?>
<?php get_header
(); ?>

<div id="left">
    <?php
    $temp 
$wp_query;
    
$wp_querynull;
    
$wp_query = new WP_Query();
    
$wp_query->query('paged='.$paged);
    
?>
    <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    
        <?php if((the_ID() <= 21 && the_ID() >= 17) || the_ID() == 82) {?>
        
        <div class="post" id="post-<?php the_ID(); ?>">
            <div class="title">
                <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
                <div class="postmeta">     <span>Posted by <?php the_author_posts_link(); ?></span> | <span><?php the_time('l, n F Y'); ?></span> | <span><?php the_category(', '); ?></span> </div>
            </div>

            <div class="entry">
                <?php the_post_thumbnail'story_feature', array('class' => 's-image') ); ?>
                <?php wpe_excerpt('wpe_excerptlength_archive'''); ?>
                <div class="clear"></div>
            </div>
        </div>
    <?php ?>
    <?php endwhile; ?>

    <?php getpagenavi(); ?>
    
    <?php $wp_query null$wp_query $temp;?>    
                
</div>

<?php get_sidebar(); ?>
<?php get_footer
(); ?>
No amigo, no funciono, al modificar el original salia una hilera de números
  #4 (permalink)  
Antiguo 18/12/2012, 07:58
 
Fecha de Ingreso: noviembre-2012
Mensajes: 67
Antigüedad: 11 años, 5 meses
Puntos: 1
Respuesta: Necesito modificar este PHP

Ya lo solucione, solo tuve que poner antes del Loop lo siguiente:
Código PHP:
<?php query_posts'cat=17,18,19,20,21,55,82&paged=' $paged); ?>
Donde entonces quedo todo de esta forma:
[PHP <?php
/*
Template Name: Blog
*/
?>
<?php get_header(); ?>

<div id="left">
<?php
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query('paged='.$paged);
?>
<?php query_posts( 'cat=17,18,19,20,21,55,82&paged=' . $paged); ?>
<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>

<div class="post" id="post-<?php the_ID(); ?>">
<div class="title">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<div class="postmeta"> <span>Posted by <?php the_author_posts_link(); ?></span> | <span><?php the_time('l, n F Y'); ?></span> | <span><?php the_category(', '); ?></span> </div>
</div>

<div class="entry">
<?php the_post_thumbnail( 'story_feature', array('class' => 's-image') ); ?>
<?php wpe_excerpt('wpe_excerptlength_archive', ''); ?>
<div class="clear"></div>
</div>
</div>
<?php ?>
<?php endwhile; ?>

<?php getpagenavi(); ?>

<?php $wp_query = null; $wp_query = $temp;?>

</div>

<?php get_sidebar(); ?>
<?php get_footer(); ?>][/PHP]

Pero gracias a tu ayuda puede resolver "anarkes"
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 03:08.