WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Creating a variable for meta id

[Resolved] Creating a variable for meta id

  • 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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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);
    ?>

    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.:)

    good =)

    (don’t forget the “resolved” )

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Creating a variable for meta id’ is closed to new replies.