Tagged: custom fields, portfolio grid, Tags
-
AuthorPosts
-
July 8, 2014 at 2:59 pm #288538
Can i add tags or some custom fields (i’m using Advanced Custom Fields) on a Portfolio Grid layout behind excerpt?
many thx!July 8, 2014 at 3:00 pm #288539Hi housedada!
Can you elaborate please? A screenshot showing changes you would like to make would help
Regards,
YigitJuly 8, 2014 at 5:07 pm #288602Of course, here a little example: https://imageshack.com/i/nll7y6p
..and this is the part of code inside portfolio.php, how i can add some custom fields from plugin “Advanced Custom Fields”?
if(!empty($title))
{
$markup = avia_markup_helper(array(‘context’ => ‘entry_title’,’echo’=>false, ‘id’=>$the_id, ‘custom_markup’=>$custom_markup));
$output .= ‘<header class=”entry-content-header”>’;
$output .= “<h3 class=’grid-entry-title entry-title’ $markup>“.$title.”</h3>”;
$output .= ‘</header>’;
}
$output .= !empty($excerpt) ? “<div class=’grid-entry-excerpt entry-content’ “.avia_markup_helper(array(‘context’=>’entry_content’,’echo’=>false, ‘id’=>$the_id, ‘custom_markup’=>$custom_markup)).”>”.$excerpt.”</div>” : ”;
$output .= !empty($title) || !empty($excerpt) ? “</div>” : ”;
$output .= ‘<footer class=”entry-footer”></footer>’;
$output .= “</article>”;
$output .= “</div>”;July 9, 2014 at 4:15 am #288785Hi!
Thank you for using the theme!
First, using the plugin create a custom field called portfolio-test for example. Edit admin > register-portfolio.php, find this code on line 38:
'supports' => array('title','thumbnail','excerpt','editor','comments')
Replace it with:
'supports' => array('title','thumbnail','excerpt','editor','comments','custom-fields')
This will enable the custom fields or portfolio items. Next edit the portfolio item then add the portfolio-test custom field. Edit config-templatebuilder > avia-shortcodes > portfolio.php find this code on line 471:
$output .= !empty($excerpt) ? "<div class='grid-entry-excerpt entry-content' ".avia_markup_helper(array('context'=>'entry_content','echo'=>false, 'id'=>$the_id, 'custom_markup'=>$custom_markup)).">".$excerpt."</div>" : '';
Replace it with this:
$custom_field1 = get_post_meta( $the_id, 'portfolio-test', true ); $output .= !empty($excerpt) ? "<div class='grid-entry-excerpt entry-content' ".avia_markup_helper(array('context'=>'entry_content','echo'=>false, 'id'=>$the_id, 'custom_markup'=>$custom_markup)).">".$excerpt."</div>" : ''; $output .= $custom_field1;
We create a variable called $custom_field1 and applied the portfolio-test key. We then output the $custom_field1 below the excerpt.
Best regards,
IsmaelJuly 9, 2014 at 2:41 pm #289013Perfect, many thx!
-
AuthorPosts
- The topic ‘Add Tags on Portfolio Grid’ is closed to new replies.