WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Creating a variable for meta id (4 posts)

  1. robmuzo
    Member
    Posted 3 years ago #

    Hi Guys I need to be able to create a wordpress query which queries the id of the page from a meta input, I have been told this can be done by putting it in a variable but have not used variables before so am unclear how to do this.

    so bassically what im looking for is this:

    <?php query_posts('page_id=7');?>

    with the page id coming from a meta which is usually pulled into the page like this:

    <?php echo get ('dynamic-meta-page-id');?>

    Any ideas how I can get the query to have the meta output in it instead of a fixed number (7)

    I have been trying to do this since yesterday but just cant make it work.

    Thanks.

    Rob.

  2. forunner
    Member
    Posted 3 years ago #

    I'm not sur to understand the problem [good explanation, but I'm french]
    If I understand :
    try this

    <?php $variable = get('dynamic-meta-page-id');
    query_posts('page_id='.$variable);
    ?>
  3. robmuzo
    Member
    Posted 3 years ago #

    Yes Thanks a lot that did the trick, so simple but so difficult if you haven't done it before.

    Thanks for you help, life saver.:)

  4. forunner
    Member
    Posted 3 years ago #

    good =)

    (don't forget the "resolved" )

Topic Closed

This topic has been closed to new replies.

About this Topic