August 8, 2013 at 1:22 pm #27435
In your other themes you have an easy way to add portfolio meta (e.g client, software etc.). I’m trying to make something like that but with custom fields, but I don’t want to change the parent theme files (yes, I’m running the child theme). I thought I could just duplicate the files into my child theme folder, but it’s not working.
Any plans on re-adding the meta? Or any suggestion on how to do this? I want that info to show directly in the ajax preview, but without having to add the text in all the items excerpt by hand.August 9, 2013 at 7:44 pm #134005
No plans right now as far as I know. It was a trade of of flexibility since we always had so many requests to change the layout of the portfolio pages.
In order to modify the files in the child theme you’ll need to replace the function that registers those files and then copy them into your child theme so that they are no longer pulled from the parent.
DevinAugust 13, 2013 at 5:45 pm #134006
Where and how do I do that? From what I understand it is in avia-shortcodes -> portfolio.php, but I can’t find where it’s getting register.August 16, 2013 at 11:20 pm #134007
I’m not really sure how to explain it. The portfolio shortcode is a class so you could do an include_once(http://php.net/manual/en/function.include-once.php) in your child functions for the new file. That file would just need to be the class by itself and whatever modifications you want to do to it.September 6, 2013 at 9:20 am #134008
Can’t get it to work. I get an error at line 10 in the portfolio.php, but I’m not sure what to exclude in that file. The only function I need to modify is build_preview_template().September 7, 2013 at 9:14 am #134009
There’s no need to exclude the file. Just create a “shortcodes” directory in your child theme folder and copy the shortcode file you want to overwrite (by default all files are located in wp-contentthemesenfoldconfig-templatebuilderavia-shortcodes) from the parent theme directory to the child theme “shortcodes” directory. Then modify the shortcode php code as you like. Afterwards insert following code at the very end of the child thrmes functions.php
add_filter('avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1);
$template_url = get_stylesheet_directory();
Note that Enfold does not support theme files of other themes. You can’t i.e. simply copy the portfolio template from Replete or Propulsion into the Enfold folder but it requires some custom work to implement new features.September 11, 2013 at 11:56 am #134010
Thanks, this works. However, I can’t get the meta info from the post. I’m using custom fields for the same purpose as the meta boxes in your other themes, but I’m unable to get that information in the shortcode.php.September 12, 2013 at 7:36 am #134011
You should be able to query any post meta field with: http://codex.wordpress.org/Function_Reference/get_post_meta
I.e. Kriesi uses following code to fetch the preview link post meta data
$custom_link = get_post_meta( $the_id ,'_portfolio_custom_link', true) != "" ? get_post_meta( $the_id ,'_portfolio_custom_link_url', true) : false;
The $the_id variable contains the post id, and the “_portfolio_custom_link” string is the name of the post meta field. But sometimes you can’t display the post meta data without extracting it from an array or serialized string and maybe some advanced coding is required. Depending on your php skills I’d recommend to hire a skilled freelancer who can take care of the post meta field implementation…
The topic ‘Portfolio meta’ is closed to new replies.