Support » Fixing WordPress » Adding posts to home page

  • <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)
  • Find:

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

    Replace with:

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

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

    ~bangs head on desk~

    Any other ideas?

    Thank you! K

    <?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?

    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>

    Ok checking now.

    thank you!

    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.

    [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

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

    Michael

    (@alchymyth)

    Forum Moderator

    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.