imi este foarte greu sa va explic ce vreau sa fac deoarece nu prea stiu ce php
am luat o tema de pe net care imi afiseaza in dreptul fiecarui titlu numele categoriei in care se afla postul
<?php jr_get_custom_taxonomy($post->ID, 'job_type', 'jtype'); ?>
in function.php am chestia asta
// get the custom taxonomy array and loop through the values
function jr_get_custom_taxonomy($post_id, $tax_name, $tax_class) {
$tax_array = get_terms( $tax_name, array( 'hide_empty' => '0' ) );
if ($tax_array && sizeof($tax_array) > 0) {
foreach ($tax_array as $tax_val) {
if ( is_object_in_term( $post_id, $tax_name, array( $tax_val->term_id ) ) ) {
echo '<span class="'.$tax_class . ' '. $tax_val->slug.'">'.$tax_val->name.'</span>';
break;
}
}
}
}
mnoah bine, functioneaza chestia doar ca io vreau sa afisez o anumita imagine in functie de categoria in care se afla postu, m-am pus io si am incercat niste php :))
<?php if ( $job_type_slug ='part-time') {
echo ('test 1');
} else {
echo ('test 2');
}
?>
numa ca indiferent ce pun la $job_type_slug el imi afiseaza tot „test 1” 🙁
aveti vreo sugestie ??