I am using cfs-custom-category-fields plugin.
In their documentation it says that to get the value of a custom field in category you should use CfsTaxonomy::get('field_name')
This works well when I am in a category page, like category-24.php
.
But it doesn't work in index.php
.
How do I get the value in a non-category page? I tried something like this:
$cat_id = 29;
if($cat_id=29){
echo CfsTaxonomy::get('arata_in_listare');
}?>
But it doesn't work.
I suppose I need to create a category page-like environment.
I am using cfs-custom-category-fields plugin.
In their documentation it says that to get the value of a custom field in category you should use CfsTaxonomy::get('field_name')
This works well when I am in a category page, like category-24.php
.
But it doesn't work in index.php
.
How do I get the value in a non-category page? I tried something like this:
$cat_id = 29;
if($cat_id=29){
echo CfsTaxonomy::get('arata_in_listare');
}?>
But it doesn't work.
I suppose I need to create a category page-like environment.
Share Improve this question asked Sep 11, 2014 at 19:36 Claudiu CreangaClaudiu Creanga 5311 gold badge4 silver badges18 bronze badges1 Answer
Reset to default 0You have to use this function: get_post_custom_values
The first parameter is the name of the key, arata_in_listare
, and the second the post id, depending on where are you making the call you might not need to pass it.
In this community we don't give support for plugins, so I'm showing you the "wordpress" way of doing this.