WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Adding array within the $my_query info (3 posts)

  1. HorrorUK
    Member
    Posted 3 years ago #

    I have set up in my admin to type in the number of posts to show and the category id (as my fiance is no good with code and it is her site).

    This is what I have right now:
    <?php $my_query = new WP_Query('showposts=2&cat=13'); ?>

    However, for the showposts, I have the following array to use instead of 2:

    <?php $section1_categoryid = get_option('section1_categoryid'); echo $section1_categoryid; ?>;

    And for the cat ID, I have the following array instead of 13:

    <?php $section1_numberofposts = get_option('section1_numberofposts'); echo $section1_numberofposts; ?>;

    The code works fine on its own, but how would I include it in the above $my_query code?

    Thanks

  2. MichaelH
    Member
    Posted 3 years ago #

    <?php $my_query = new WP_Query('showposts='.$section1_numberofposts.'&cat='.$section1_categoryid); ?>
  3. HorrorUK
    Member
    Posted 3 years ago #

    thanks, that works good

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.