Tagged: x
-
AuthorPosts
-
December 4, 2016 at 1:27 pm #1280682
pcrossnzParticipantHi again.
Thanks for your response! I found that if I substituted one of the terms, Ie, ‘portfolio-category’ for another of my own custom terms. Eg/ ‘grade’, then it will output that term.
if ( get_post_type() == 'grade' ) { if ( has_term( '', 'grade', NULL ) ) { $categories = get_the_terms( get_the_ID(), 'grade' ); $separator = ', '; $categories_output = ''; foreach ( $categories as $category ) { $categories_output .= '<a href="' . get_term_link( $category->slug, 'grade' ) . '" title="' . esc_attr( sprintf( __( "View all posts in: “%s”", '__x__' ), $category->name ) ) . '"><i class="x-icon-bookmark" data-x-icon=""></i> ' . $category->name . '</a>' . $separator; }Could you help me to add in the extra terms. Ie, ‘grade’, ‘sections’ and ‘region’ to the original code.
if ( get_post_type() == 'grade' AND 'sections' AND 'region' ) { if ( has_term( '', 'grade' AND 'sections' AND 'region', NULL ) ) { $categories = get_the_terms( get_the_ID(), 'grade' ); $separator = ', '; $categories_output = ''; foreach ( $categories as $category ) { $categories_output .= '<a href="' . get_term_link( $category->slug, 'grade' AND 'sections' AND 'region' ) . '" title="' . esc_attr( sprintf( __( "View all posts in: “%s”", '__x__' ), $category->name ) ) . '"><i class="x-icon-bookmark" data-x-icon=""></i> ' . $category->name . '</a>' . $separator; }I’m not sure how to add these to the original code in php.
Thanks so much for your time!
Phil
December 4, 2016 at 7:00 pm #1280948
Rue NelModeratorHello Phil,
Thanks for updating us in! Replacing the
portfolio-categorywith something in your custom term may not work just yet. We need to determine which is the custom port type and what is the term name for your custom taxonomy. Grade may not be the custom post type and maybe it’s just a taxonomy. To assist you better with this issue, would you mind providing us the url of your site with login credentials so we can take a closer look? This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.To do this, you can make a post with the following info:
– Link to your site
– WordPress Admin username / passwordDon’t forget to select Set as private reply. This ensures your information is only visible to our staff.
Thank you.
December 6, 2016 at 12:00 am #1282624
pcrossnzParticipantThis reply has been marked as private.December 6, 2016 at 7:24 pm #1283936
LelyModeratorHello Phil,
Upon checking, it grades, sections, and region are custom taxonomy attached to your post and portfolio. From the data I saw, you do have attached for portfolio at the moment. Please try the following code:
function x_icon_entry_meta() { $date = sprintf( '<span><time class="entry-date" datetime="%1$s">%2$s</time></span>', esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) ); // // Categories. // if ( get_post_type() == 'x-portfolio' ) { if ( has_term( '', 'portfolio-category', NULL ) ) { $categories = get_the_terms( get_the_ID(), 'portfolio-category' ); $separator = ', '; $categories_output = ''; foreach ( $categories as $category ) { $categories_output .= '<a href="' . get_term_link( $category->slug, 'portfolio-category' ) . '" title="' . esc_attr( sprintf( __( "View all posts in: “%s”", '__x__' ), $category->name ) ) . '"><i class="x-icon-bookmark" data-x-icon=""></i> ' . $category->name . '</a>' . $separator; } $categories_list = sprintf( '<span>%s</span>', trim( $categories_output, $separator ) ); } elseif ( has_term( '', 'grade', NULL ) ) { $categories = get_the_terms( get_the_ID(), 'grade' ); $separator = ', '; $categories_output = ''; foreach ( $categories as $category ) { $categories_output .= '<a href="' . get_term_link( $category->slug, 'grade' ) . '" title="' . esc_attr( sprintf( __( "View all posts in: “%s”", '__x__' ), $category->name ) ) . '"><i class="x-icon-bookmark" data-x-icon=""></i> ' . $category->name . '</a>' . $separator; } $categories_list = sprintf( '<span>%s</span>', trim( $categories_output, $separator ) ); }elseif ( has_term( '', 'sections', NULL ) ) { $categories = get_the_terms( get_the_ID(), 'sections' ); $separator = ', '; $categories_output = ''; foreach ( $categories as $category ) { $categories_output .= '<a href="' . get_term_link( $category->slug, 'sections' ) . '" title="' . esc_attr( sprintf( __( "View all posts in: “%s”", '__x__' ), $category->name ) ) . '"><i class="x-icon-bookmark" data-x-icon=""></i> ' . $category->name . '</a>' . $separator; } $categories_list = sprintf( '<span>%s</span>', trim( $categories_output, $separator ) ); } elseif ( has_term( '', 'region', NULL ) ) { $categories = get_the_terms( get_the_ID(), 'region' ); $separator = ', '; $categories_output = ''; foreach ( $categories as $category ) { $categories_output .= '<a href="' . get_term_link( $category->slug, 'region' ) . '" title="' . esc_attr( sprintf( __( "View all posts in: “%s”", '__x__' ), $category->name ) ) . '"><i class="x-icon-bookmark" data-x-icon=""></i> ' . $category->name . '</a>' . $separator; } $categories_list = sprintf( '<span>%s</span>', trim( $categories_output, $separator ) ); } else { $categories_list = ''; } } else { $categories = get_the_category(); $separator = ', '; $categories_output = ''; foreach ( $categories as $category ) { $categories_output .= '<a href="' . get_category_link( $category->term_id ) . '" title="' . esc_attr( sprintf( __( "View all posts in: “%s”", '__x__' ), $category->name ) ) . '"><i class="x-icon-bookmark" data-x-icon=""></i> ' . $category->name . '</a>' . $separator; } $categories_list = sprintf( '<span>%s</span>', trim( $categories_output, $separator ) ); } if ( x_does_not_need_entry_meta() ) { return; } else { printf( '<p class="p-meta">%1$s%2$s</p>', $date, $categories_list ); } }The code check if your portfolio item has those specific term/taxonomy.
Further customizations from here would be getting into custom development, which is outside the scope of support we can offer. If you need more in depth changes, you may wish to consult with a developer. X is quite extensible with child themes, so there are plenty of possibilities. Thanks for understanding.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1177346 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
