You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your plugin is very useful, As I have seen comments. But I am not able to print the custom fields on my custom template page. I know it will be a silly mistake. But not able to figure it out from last 3 hours.
What I trying to achieve is on parent category page, I want to show child categories with image.
Here is my category.php
category_parent != 0)
{
//Loop to show post, If category has parent
}
else
{
// Display sub categories with images only
$args = array(
'orderby' => 'id',
'order' => 'ASC',
'hide_empty' => 1,
'hierarchical' => 0,
'child_of' => $parent_cat_id
);
$categories= get_categories($args);
foreach( $categories as $category)
{
$saved_data = get_tax_meta($category->term_id,'text_field_id');
echo $saved_data;
$saved_data1 = get_tax_meta($category->term_id,'image_field_id',true);
echo '
Note - on print_r($category)
I get this result -
stdClass Object ( [term_id] => 2 [name] => Accounts [slug] => accounts [term_group] => 0 [term_taxonomy_id] => 2 [taxonomy] => category [description] => This is a account book description [parent] => 1 [count] => 1 [cat_ID] => 2 [category_count] => 1 [category_description] => This is a account book description [cat_name] => Accounts [category_nicename] => accounts [category_parent] => 1 )
Is I am doing wrong ? Nothing is showing on screen, whatever I added to new custom fields.
I check the value for $saved_data, but it is blank and $saved_data1 is giving the error - Illegal string offset 'src'
Any help or hint ?
The text was updated successfully, but these errors were encountered:
Hi
Your plugin is very useful, As I have seen comments. But I am not able to print the custom fields on my custom template page. I know it will be a silly mistake. But not able to figure it out from last 3 hours.
What I trying to achieve is on parent category page, I want to show child categories with image.
Here is my category.php
category_parent != 0) { //Loop to show post, If category has parent } else { // Display sub categories with images only $args = array( 'orderby' => 'id', 'order' => 'ASC', 'hide_empty' => 1, 'hierarchical' => 0, 'child_of' => $parent_cat_id ); $categories= get_categories($args); foreach( $categories as $category) { $saved_data = get_tax_meta($category->term_id,'text_field_id'); echo $saved_data; $saved_data1 = get_tax_meta($category->term_id,'image_field_id',true); echo ''; $link = get_category_link( $parent_cat_id ).$category->slug; echo "".$category->name.""; } } ?>
The text was updated successfully, but these errors were encountered: