-
AuthorPosts
-
November 20, 2014 at 1:16 am #354074
Hello,
I am using the Blog Posts content element in the layout builder. On your page, http://kriesi.at/themes/enfold/blog/blog-grid/, it shows the comments and timestamp under the headline. For some reason this meta is not appearing on my site.I’ve selected Display Blog Posts / Grid Layout / show Title & Excerpt and Read More Link. But how can I turn on the timestamp?
I also need to move the timestamp above the headline, and display the category the post is in. What php file allows me to make these edits?
Thanks in advance.
November 20, 2014 at 6:26 am #354126Just to note, I did check my theme options > Blog Layout to ensure that all meta elements were checked to be visible.
November 20, 2014 at 6:48 pm #354376Hi!
It looks like you have this in your style.css file which is hiding it on your homepage.
#home .slide-meta { display: none; }
To move it above the title then open up /enfold/config-templatebuilder/avia-shortcodes/postslider.php and move lines 375 – 388.
if($show_meta && !empty($excerpt)) { $output .= "<div class='slide-meta'>"; if ( $commentCount != "0" || comments_open($the_id) && $entry->post_type != 'portfolio') { $link_add = $commentCount === "0" ? "#respond" : "#comments"; $text_add = $commentCount === "1" ? __('Comment', 'avia_framework' ) : __('Comments', 'avia_framework' ); $output .= "<div class='slide-meta-comments'><a href='{$link}{$link_add}'>{$commentCount} {$text_add}</a></div><div class='slide-meta-del'>/</div>"; } $markup = avia_markup_helper(array('context' => 'entry_time','echo'=>false, 'id'=>$the_id, 'custom_markup'=>$custom_markup)); $output .= "<time class='slide-meta-time updated' $markup>" .get_the_time(get_option('date_format'), $the_id)."</time>"; $output .= "</div>"; }
To line 369 so they display above this.
$markup = avia_markup_helper(array('context' => 'entry_title','echo'=>false, 'id'=>$the_id, 'custom_markup'=>$custom_markup)); $output .= '<header class="entry-content-header">'; $output .= !empty($title) ? "<h3 class='slide-entry-title entry-title' $markup><a href='{$link}' title='".esc_attr(strip_tags($title))."'>".$title."</a></h3>" : ''; $output .= '</header>';
Regards,
ElliottNovember 20, 2014 at 8:11 pm #354417Thanks Elliott. I forgot I had that css on the homepage; thanks. I removed it. However the Blog Posts panel still only shows the date (I would like to show author, date and category), and the meta is not appearing on the blog pages.
November 20, 2014 at 8:15 pm #354418This reply has been marked as private.November 21, 2014 at 5:06 pm #355306Hi!
The grid layout only shows comments and the date by default because it has a shorter width. You can add them in around line 381 in /enfold/config-templatebuilder/avia-shortcodes/postslider.php.
$output .= ' / '; $taxonomies = get_object_taxonomies(get_post_type($the_id)); $cats = ''; $excluded_taxonomies = apply_filters('avf_exclude_taxonomies', array('post_tag','post_format'), get_post_type($the_id), $the_id); if(!empty($taxonomies)) { foreach($taxonomies as $taxonomy) { if(!in_array($taxonomy, $excluded_taxonomies)) { $cats .= get_the_term_list($the_id, $taxonomy, '', ', ','').' '; } } } if(!empty($cats)) { $output .= '<span class="blog-categories minor-meta">'.__('in','avia_framework')." "; $output .= $cats; $output .= '</span><span class="text-sep text-sep-cat">/</span>'; } $output .= "</div>"; $output .= '<span class="blog-author minor-meta">'.__('by','avia_framework')." "; $output .= '<span class="entry-author-link" '.avia_markup_helper(array('context' => 'author_name','echo'=>false)).'>'; $output .= '<span class="vcard author"><span class="fn">'; $output .= get_the_author(); $output .= '</span></span>'; $output .= '</span>'; $output .= "</div>";
Just beneath this line.
$output .= "<time class='slide-meta-time updated' $markup>" .get_the_time(get_option('date_format'), $the_id)."</time>";
Regards,
Elliott- This reply was modified 10 years ago by Elliott.
November 21, 2014 at 6:51 pm #355420That broke the site. Can you check that code?
November 22, 2014 at 6:48 pm #355960Hey!
There was a small typo. Try it again.
Regards,
ElliottDecember 3, 2014 at 8:33 pm #362459How do I exclude a category from displaying in the meta list? For example, we have a category called Small Featured and a cat called Large Featured Category IDs are 31 and 37). I’d like to prevent these two category titles from appearing in the meta underneath the title.
Also – the code above made the meta appear on the homepage, but it is still not appearing on the Insights page.
Thanks.December 3, 2014 at 8:33 pm #362460This reply has been marked as private.December 3, 2014 at 8:45 pm #362466I figured out how to only show the first category, for those interested, change the $cats section to the following:
$cats = explode(',', $cats); if(!empty($cats)) { $output .= '<span class="blog-categories minor-meta">'.__('in','avia_framework')." "; $output .= $cats[0]; $output .= '</span><span class="text-sep text-sep-cat"></span>'; }
Attempting to make this code appear on the other pages, including Single post.
December 3, 2014 at 9:00 pm #362472The code I posted above only shows the first category, but I still need to exclude categories 31 and 37. Thanks.
December 4, 2014 at 6:00 pm #363054Hey!
Here is the function used, http://codex.wordpress.org/Function_Reference/get_the_term_list, which does not have an option for that so I don’t see an easy way of doing that unfortunately.
You might be able to do it with this, http://codex.wordpress.org/Function_Reference/get_categories, but this is starting to border on custom work so it would be best to hire a freelancer to help you out with this customization.
Cheers!
Elliott -
AuthorPosts
- You must be logged in to reply to this topic.