Derk Oosterveld
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Custom fields data disappears after a few mins?I’m so happy that you give the fix!
I understood nothing about this problem.Thanks a lot.
Forum: Fixing WordPress
In reply to: Active class for taxomony, when showing the postI’ve got it!
This code gives the current productcat:
<?php $term = get_term_by( 'name', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?>
And with that piece of code I check if it’s active:
<?php if($tax_menu_item->name == $term_active) { echo"class=\"current_cat\""; } ?>
The query to get all the cats is:
<?php $args = array('taxonomy' => 'productcats'); $tax_menu_items = get_categories( $args ); ?>
Thanks everybody!
Forum: Fixing WordPress
In reply to: Active class for taxomony, when showing the postHm, that doesn’t work. It’s a array, but it is empty, I think.
This code:
$terms = wp_get_object_terms($post->ID, 'productcats' ); echo $terms[0];
Give this error:
Catchable fatal error: Object of class stdClass could not be converted to string in
This code works, but gives the whole HTML for a link:
echo get_the_term_list( $post->ID, 'productcats');
Maybe it is possible to remove all the things like a tag etc.?
Forum: Fixing WordPress
In reply to: Active class for taxomony, when showing the postThe taxomony is “productcats”. With this code,
echo get_the_term_list( $post->ID, 'productcats');
I get de active cat, I want to work with.With your code I can not in each category along and check what is empty. It is not a code that checks which categories are in productcats.
Forum: Fixing WordPress
In reply to: Active class for taxomony, when showing the post$productnr1 = get_the_term_list($post->ID,'productnr1');
This code returns which productcat the product has. I can’t use that output, because it’s a HTML string.The other option, you gave, is not my preference, associated with updating.
Forum: Fixing WordPress
In reply to: Active class for taxomony, when showing the postThe function get_the_category doesn’t work.
But I have a function (get_the_term_list) that display the productcat of the product:
echo get_the_term_list( $post->ID, 'productcats');
But the output is a HTML string. Can anyone help me to get only the name of the productcat, not the whole HTML for a link?
Forum: Fixing WordPress
In reply to: Active class for taxomony, when showing the postI think I need to set up a query to list all the items in the taxomony. But I need to check which category (from productcats) is active. Is there a function that give the category from a post?