Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #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.

    #134005

    Hi emilottersten,

    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.

    Regards,

    Devin

    #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.

    #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.

    #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().

    #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);
    function avia_include_shortcode_template($paths)
    {
    $template_url = get_stylesheet_directory();
    array_unshift($paths, $template_url.'/shortcodes/');

    return $paths;
    }

    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.

    #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.

    #134011

    Hi,

    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…

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Portfolio meta’ is closed to new replies.