Hi harlemS,
Can I get the code that you try to implement ?
Please post ten or less lines of the code you are trying to use, starting 5 lines before where you are retrieving the CF, and including the line to get the CF.
MJ
(@mardie)
Must have the ID.. Try something like this:
<?php $pageid = get_the_ID();
echo get_post_meta($pageid, 'hubcategory', true); ?>
I tried this:
<?php query_posts(array('cat'=>get_post_meta($pageid, 'hubcategory', true))); ?>
But i’m getting a Syntax error.
If you are using this to get the category id stored in a custom field named ‘hubcategory’, on a Page, please put the code for the entire template in a pastebin so it can be examined.
This may work, depending on the template:
<?php $cat_id = get_post_meta($post->ID,'hubcategory',true);
query_posts(array('cat' => $cat_id); ?>
Here’s a paste bin of the code.
You are using both a ‘new WP_Query()’ and a ‘query_posts()’ in your code. You only need the WP_Query. Try replacing this:
<?php $wp_query = new WP_Query(array('showposts'=>12,'paged'=>$paged)); ?>
<?php $cat_id = get_post_meta($post->ID,'hubcategory',true); query_posts(array('cat' => $cat_id); ?>
with this:
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$cat_id = get_post_meta($post->ID,'hubcategory',true); ?>
<?php $wp_query = new WP_Query(array('showposts'=>12,'paged'=>$paged, 'cat' => $cat_id)); ?>