Forums

[resolved] Adding a variable into a WP Query (4 posts)

  1. Steven Jones
    Member
    Posted 3 years ago #

    Hi,

    How would I go about adding the variable $numberofposts into a new Query?
    I have tried this but my PHP skills aren't the best. I guess I'm doing something wrong after the = sign.

    new WP_Query('showposts=$numberofposts');

    Cheers,
    Steve

  2. Steven Jones
    Member
    Posted 3 years ago #

    Any ideas?

  3. Lester Chan
    Member
    Posted 3 years ago #

    WP_Query("showposts=$numberofposts");

    Use double quotes

  4. Steven Jones
    Member
    Posted 3 years ago #

    Thank you very much.

Topic Closed

This topic has been closed to new replies.

About this Topic