Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter spexy90

    (@spexy90)

    Yes, I solved it like this:

    
    if ( function_exists( 'the_seo_framework' ) ) {
    					$term = the_seo_framework()->get_primary_term(get_the_ID(), 'portfolio-types' );
    				}
    
    				if ( empty( $term ) ) {
    					$cats = get_the_category(); 
    					if ( $cats ) {
    							$cats = wp_list_sort(
    									$cats,
    									[ 'term_id' => 'ASC' ]
    							);
    							$term = $cats[0];
    					}
    				}
    
    				if ( ! empty( $term ) || $portfolio_page_id) {
    					$breadcrumbs[] = '<a href="'. esc_url(get_term_link($term)) .'">'. esc_html($term->name) .'</a>';
    				}
    
    

    Thanks for your help!

    Thread Starter spexy90

    (@spexy90)

    Thank you! But I’m learning php … so if I had to insert everything with the href tag it would be something like that?

    
    if ( function_exists( 'the_seo_framework' ) ) { 
    					$term = the_seo_framework()->get_primary_term();
    				}
    				
    				// Default to WordPress's best effort when no valid term is returned.
    				if ( empty( $term ) ) { 
    					$cats = get_the_category(); // this returns an array... nice function name :)
    					if ( $cats ) {
    						$cats = wp_list_sort(
    							$cats,
    							[ 'term_id' => 'ASC' ]
    						);
    						$term = $cats[0];
    					}
    				}
    				
    				if ( ! empty( $term ) || $portfolio_page_id) {
    					$breadcrumbs[] = '<a href="'. esc_url(?) .'">'. esc_url(?) .'</a>';
    				}
    

    How do i get url and name?
    Thank you very much, very kind

Viewing 2 replies - 1 through 2 (of 2 total)