WordPress.org

Support

Support » How-To and Troubleshooting » Adding posts to home page

Adding posts to home page

  • goddesskarla
    Member

    @goddesskarla

    <table width="100%" border="0" cellpadding="75" cellspacing="0">
      <tr>
        <td width="50%" valign="top">
    
    <h3>News</h3>
    
    <?php query_posts( array( 'category__and' => array(4), 'posts_per_page' => 3, 'orderby' => 'title', 'order' => 'DESC' ) ); ?>
    
    <?php while (have_posts()) : the_post(); ?>
    <li><a href="<?php the_permalink() ?>"><b><?php the_title(); ?></b></a></li>
    
    <a href="<?php the_permalink() ?>">Read More</a>
    <?php endwhile;?></td>
        <td valign="top">
    <h3>Blog</h3>
    
    <?php wp_reset_query();?>
    
    <?php query_posts (query_string . 'cat=3' ); ?>
    
    <?php while (have_posts()) : the_post(); ?>
    <li><a href="<?php the_permalink() ?>"><b><?php the_title(); ?></b></a></li>
    
    <a href="<?php the_permalink() ?>">Read More</a>
    <?php endwhile;?></td>
      </tr>
    </table>

    Using this code for the second loop..
    `<?php query_posts (query_string . ‘cat=3′ ); ?>’

    It is not pulling from only cat 3.. It pulls from all categories..

    Any ideas would be appreciated!

    Thanks! Karla

Viewing 10 replies - 1 through 10 (of 10 total)
  • Rajesh Soni
    Participant

    @rajeshsoni

    Find:

    <?php query_posts (query_string . 'cat=3' ); ?>

    Replace with:

    <?php query_posts (query_string . '&cat=3' ); ?>
    goddesskarla
    Member

    @goddesskarla

    When I add the & it disables the slider.. 8(

    ~bangs head on desk~

    Any other ideas?

    Thank you! K

    Rajesh Soni
    Participant

    @rajeshsoni

    <?php query_posts (query_string . 'cat=3' ); ?>

    What is query_string, a variable?

    Can you echo it somewhere and notice how the query is built?

    goddesskarla
    Member

    @goddesskarla

    Here is the complete code for the two additions to the page..

    I don’t mind paying you for your time if you can get this to work in the next hour.

    <table width="100%" border="0" cellpadding="75" cellspacing="0">
      <tr>
        <td width="50%" valign="top">
    
    <h3>News</h3>
    
    <?php query_posts( array( 'category__and' => array(4), 'posts_per_page' => 3, 'orderby' => 'title', 'order' => 'DESC' ) ); ?>
    
    <?php while (have_posts()) : the_post(); ?>
    
    <li><a>"><b><?php the_title(); ?></b></a></li>
    <a>">Read More</a>
    <?php endwhile;?></td>
        <td valign="top">
    <h3>Blog</h3>
    
    <?php wp_reset_query();?>
    
    <?php query_posts (query_string . 'cat=3' ); ?>
    
    <?php while (have_posts()) : the_post(); ?>
    
    <li><a>"><b><?php the_title(); ?></b></a></li>
    <a>">Read More</a>
    <?php endwhile;?></td>
      </tr>
    </table>
    Rajesh Soni
    Participant

    @rajeshsoni

    Ok checking now.

    goddesskarla
    Member

    @goddesskarla

    thank you!

    Rajesh Soni
    Participant

    @rajeshsoni

    Find

    <?php query_posts (query_string . 'cat=3' ); ?>

    Replace with:

    <?php
    echo "<h3>query_string: " . query_string . "</h3>";
    query_posts (query_string . 'cat=3' );
    ?>

    Then run and share the output.

    goddesskarla
    Member

    @goddesskarla

    [email address moderated – this forum does not provide support via email]

    I will give you access to the testing server .. if that would assist you and save time?

    Thank you so MUCH! Karla

    goddesskarla
    Member

    @goddesskarla

    It is still showing posts from all categories.. and the header is
    query_string: query_string

    Michael
    Forum Moderator

    @alchymyth

    I don’t mind paying you for your time if you can get this to work in the next hour.

    unfortunately, the topic has to be closed per forum rules – http://codex.wordpress.org/Forum_Welcome#Offering_to_Pay

    consider posting a job at http://jobs.wordpress.net/

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Adding posts to home page’ is closed to new replies.