Query posts by custom meta tags
-
Hello everyone, thanks for taking your time to try and assist me.
I am an owner of a video game website and I am trying to create pages that will display all posts of a specific game. I am aware that I can use tags to achieve such a result, but I want to customize the page with specific attributes.
Since I will be constantly creating new pages for new games, I am trying to create a code that will allow me to customize my query for each page, that way I don’t have to create a new template every time.
I want to display posts for one specific game for each page, so I can’t use tag=’value’ I need to customize it with custom fields.
Here is my code:
<?php query_posts(‘tag=<?php echo get_post_meta($post->ID, ‘game’, true); ?>’); ?>
The only problem is that I get this error
Parse error: syntax error, unexpected T_STRING in D:\xampp\htdocs\wordpress\wp-content\themes\RewindReplayNetwork\custom page.php on line 60
Is there anyway to work around that?
Thank you in advance for helping me.
The topic ‘Query posts by custom meta tags’ is closed to new replies.