-
AuthorPosts
-
July 12, 2016 at 5:46 pm #659999
I’m looking for the single portfolio template. I need to change it to add a custom field. What file must I modify?
July 12, 2016 at 9:30 pm #660102Hey alnalu!
If you are using ALB, that is not possible to be done.
Can you please give us some more informations what you need to do so we can help you?
based on the area, there might be a hook which can be used.Best regards,
BasilisJuly 13, 2016 at 9:29 am #660235Sure,
I need to have two diferent titles for any porfolio item. One title is show on portfolio gallery. The other one is show on portfolio item.
I’ve done this in the pages, using a template. But I dont know what file must modify to add a custom field on a portfolio item.July 15, 2016 at 12:45 pm #661222Hi,
Would using shortcodes help you? Also, can you please post a screenshot and show the changes you would like to make so we can understand better? :)
You can upload your screenshots on imgur.com or Dropbox public folder and post the links hereBest regards,
YigitJuly 15, 2016 at 2:13 pm #661278Here
July 15, 2016 at 2:31 pm #661287Hi!
Please try adding following code to Functions.php file in Appearance > Editor
add_filter('avf_title_args', 'fix_single_portfolio_title', 10, 2); function fix_single_portfolio_title($args,$id) { if (is_singular( 'portfolio' )) { $args['title'] = get_custom_title(); $args['link'] = get_permalink($id); $args['heading'] = 'h1'; } return $args; }
Cheers!
YigitJuly 15, 2016 at 5:06 pm #661442It doesn’t works. This causes a 500 error appears in the frontend.
The custom fields options of portfolio items are not visibles.July 15, 2016 at 9:19 pm #661543Hi!
Do you mind posting temporary admin logins and FTP logins to your development server so we can look into it?
Best regards,
YigitJuly 25, 2016 at 11:52 am #664561login data
July 27, 2016 at 4:29 am #665594Hi,
What is the name of the custom field? Portfolio items do not support custom fields by default so you have to add this in the functions.php file to enable custom fields on portfolio items:
//enable custom fields for portfolio items add_filter( 'avf_portfolio_cpt_args', 'avf_portfolio_cpt_args_mod', 1 ); function avf_portfolio_cpt_args_mod( $args ) { $args['supports'][] = 'custom-fields'; return $args; }
Change the value of the meta key (customfieldname) here:
add_filter('avf_title_args', 'fix_single_portfolio_title', 10, 2); function fix_single_portfolio_title($args,$id) { $title = get_post_meta($id, 'customfieldname', true); if (is_singular( 'portfolio' )) { $args['title'] = $title; } return $args; }
Best regards,
IsmaelJuly 27, 2016 at 9:12 am #665637Thx Ismael
It works ok -
AuthorPosts
- The topic ‘Template file for single portfolio’ is closed to new replies.