Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter('em_category_output_placeholder','my_em_styles_placeholders',1,3);
- function my_em_styles_placeholders($replace, $EM_Category, $result){
- global $wp_query, $wp_rewrite;
- switch( $result ){
- case '#_CATEGORYPARENT':
- $replace = '';
- $arrCategory = get_terms(EM_TAXONOMY_CATEGORY,array('parent'=>0,'hide_empty'=>0) );
- foreach($arrCategory as $arrterm) {
- $child = get_term_children($arrterm->term_id,EM_TAXONOMY_CATEGORY);
- if ( (count($child) == 0) && ($EM_Category->name == $arrterm->name) ){
- $replace = '<a href="' . get_term_link( $EM_Category->name, EM_TAXONOMY_CATEGORY ) . '">' . $EM_Category->name .'</a>' ;
- }else if ( (count($child) > 0) && ($EM_Category->name == $arrterm->name) ){
- $replace = '<a href="' . get_term_link( $EM_Category->name, EM_TAXONOMY_CATEGORY ) . '">' . $EM_Category->name .'</a>' ;
- }else{
- foreach($child as $term_child_id) {
- $term_child = get_term_by('id',$term_child_id,EM_TAXONOMY_CATEGORY);
- if ( $term_child->name == $EM_Category->name ){
- $replace = '<a href="' . get_term_link( $arrterm->name, EM_TAXONOMY_CATEGORY ) . '">' . $arrterm->name . '</a>';
- }
- }
- }
- }
- }
- return $replace;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement