-
AuthorPosts
-
November 9, 2022 at 4:57 am #1371849
On my portfolio grid layout, how can I show the portfolio category name?
November 10, 2022 at 9:20 am #1372024Hey navindesigns,
Thank you for the inquiry.
You have to modify the themes/enfold/config-templatebuilder/avia-shortcodes/portfolio/portfolio.php file and place the code below around line 1061.
$categories = get_the_terms($key['ID'], 'portfolio_entries'); $separator = ' '; $output = '<div class="av-portfolio-cat">'; if ( ! empty( $categories ) ) { foreach ( $categories as $category ) { $output .= '<span>' . esc_html( $category->name ) . '</span>' . $separator; } } $output .= '</div>';
You can add it right below this code.
if ( ! empty( $title_link ) ) { $output .= "<a href='{$title_link}' title='" . esc_attr( strip_tags( $title ) ) . "'>" . $title . "</a>"; } else { $output .= $title; }
Best regards,
IsmaelNovember 11, 2022 at 5:56 pm #1372251Thanks
Can this be added to my child theme to avoid any issues when updating the theme?
November 13, 2022 at 1:05 am #1372378Hi,
You can add this function to your child theme functions.php:function avia_include_shortcode_template( $paths ) { if( ! is_array( $paths ) ) { $paths = array(); } $template_url = get_stylesheet_directory(); array_unshift( $paths, $template_url . '/shortcodes/' ); return $paths; } add_filter( 'avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1 );
then in your child theme directory create a new directory /shortcodes/ then copy the folder with your customized element into it, in your case /portfolio/portfolio.php
Best regards,
MikeNovember 13, 2022 at 10:58 pm #1372455Hi,
I followed your instructions (adding to the child theme) but nothing is showing up on the front end.Thanks
November 13, 2022 at 11:26 pm #1372458Hi,
Did the solution work when you edited the /portfolio/portfolio.php file as Ismael suggested?
Please try it that way to ensure his solution works.Best regards,
MikeNovember 13, 2022 at 11:31 pm #1372460Hi Mike,
That did not work. That broke the page somewhat
Screenshot (after inserting Ismael code in themes/enfold/config-templatebuilder/avia-shortcodes/portfolio/portfolio.php ) – https://ibb.co/gVWFqnt
I went ahead and remove the code
Thanks
November 14, 2022 at 7:44 am #1372477Hi!
Thanks for the update.
We corrected the above modification for the portfolio.php file. Please try it again. https://kriesi.at/support/topic/show-portfolio-categories-2/#post-1372024
Cheers!
IsmaelNovember 17, 2022 at 2:18 am #1372864Hi guys
This is still not working on either on the main enfold theme or enfold child.
Would you mind taking a look again?
November 18, 2022 at 9:31 am #1373045Hi,
Looks like you are trying to override the portfolio.php file in your child theme, but the current folder structure is incorrect. Please rename the config-templatebuilder folder to shortcodes and move the content of the avia-shortcodes folder one directory up inside the shortcodes folder or move the portfolio folder outside the avia-shortcodes folder, then delete the avia-shortcodes folder because it is no longer necessary. The modification should work after correcting the folder structure. If not, try to implement it directly in the parent theme template.
Thank you for your patience.
Best regards,
Ismael- This reply was modified 2 years ago by Ismael.
-
AuthorPosts
- You must be logged in to reply to this topic.