WordPress.org

Ready to get started?Download WordPress

Forums

[closed] Adding posts to home page (11 posts)

  1. goddesskarla
    Member
    Posted 1 year ago #

    <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

  2. Rajesh Soni
    Member
    Posted 1 year ago #

    Find:

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

    Replace with:

    <?php query_posts (query_string . '&cat=3' ); ?>
  3. goddesskarla
    Member
    Posted 1 year ago #

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

    ~bangs head on desk~

    Any other ideas?

    Thank you! K

  4. Rajesh Soni
    Member
    Posted 1 year ago #

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

  5. goddesskarla
    Member
    Posted 1 year ago #

    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>
  6. Rajesh Soni
    Member
    Posted 1 year ago #

    Ok checking now.

  7. goddesskarla
    Member
    Posted 1 year ago #

    thank you!

  8. Rajesh Soni
    Member
    Posted 1 year ago #

    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.

  9. goddesskarla
    Member
    Posted 1 year ago #

    [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

  10. goddesskarla
    Member
    Posted 1 year ago #

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

  11. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    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/

Topic Closed

This topic has been closed to new replies.

About this Topic