Tagged: excerpt, grid layout
-
AuthorPosts
-
June 3, 2013 at 2:45 am #24227
Is there a way to specify the default excerpt length for blog posts in the Grid layout? If I choose “Multi Author Blog,” “Single Author, small preview Pic,” “Single Author, big preview Pic,” the excerpt is the correct length by default. As far as I can tell, the only one that’s messed up is the “Grid Layout.”
You can see what I’m talking about by going to TheCaliforniaPost.com.
I did some searching in the forum and found an answer, but it wasn’t for the default. It basically stated that you can go into each post and specify the excerpt one-by-one by going into screen options at the top, clicking excerpt, and then defining the excerpt… There has to be a way to set a default so that we don’t have to do each one individually..
Also, I’m looking into a new theme for a new project and I’m very impressed with Enfold. Do all of your themes have the Avia Layout builder as well as the updated theme options panel or is this just a feature included with the newest themes such as Enfold, Replete, Incarnation, etc?
Thanks!
June 3, 2013 at 5:23 am #1228011) You can try to use the excerpt length filter: http://codex.wordpress.org/Function_Reference/the_excerpt#Control_Excerpt_Length_using_Filters – insert the code at the bottom of functions.php.
2) The advanced layout builder is only included in Enfold. Other (“older”) themes do not support this feature however Replete, Incarnation, etc. support a “Template Builder” which is similar to (but not as flexible as) the layout builder.
June 3, 2013 at 6:24 am #122802Thanks Dude
June 3, 2013 at 6:28 am #122803Actually, I installed 1.5.1 and now the excerpt doesn’t even show up in the Grid Layout…?
Any ideas as to why?
June 3, 2013 at 2:39 pm #122804Glen, I’m in the same boat as you, and would like to have more flexibility with the Grid Layout when used as the default blog layout.
Peter, would you be able to point us to the appropriate .php file to toggle: excerpt on/off, excerpt length, time and/or date on/off?
Much appreciated,
Paul
June 4, 2013 at 1:00 am #122805Hi,
You can edit includes > loop-index.php, find this code.
$current_post['content'] = $blog_content == "content" ? get_the_content(__('Read more','avia_framework').'<span class="more-link-arrow"> →</span>') : get_the_excerpt();
$current_post['content'] = $blog_content == "excerpt_read_more" ? $current_post['content'].'<div class="read-more-link"><a href="'.get_permalink().'" class="more-link">'.__('Read more','avia_framework').'<span class="more-link-arrow"> →</span></a></div>' : $current_post['content'];To disable date and time, find this code and remove it.
echo "<span class='date-container minor-meta'>".get_the_time('d M Y')."</span>";
echo "<span class='text-sep'>/</span>";Regards,
Ismael
June 4, 2013 at 7:21 pm #122806Hi Ismael,
I found the code in your top box and I don’t see where to edit the includes to make the excerpt show up in Grid Layout? If I’m not mistaken, this is a problem with the theme (I do have the most recent version 1.5.1 and this was even a problem with the previous version). With the previous theme, the excerpt was completely random (sometimes two lines, and sometime seven lines), there was no rhyme or reason for the default length. As I stated before, in “Multi Author,” “Single Author small,” and “Single Author big,” the excerpt is the correct length by default. The only problem I’m seeing here is the Grid Layout and this is a theme issue (with 1.5.1, the excerpt doesn’t even show up).
As far as the code in your bottom box, this does remove the code for the date in single page posts (which I would guess would be controlled in the single.php file), but this code doesn’t remove the date in the Grid layout of the blog page. Is the second part of this code to remove the code for the date also found in the loop-index.php file, or is it found in a different file of the theme?
Thanks for your time!
June 5, 2013 at 6:35 am #122807We’ll fix this in the next version. For now open up wp-contentthemesenfoldconfig-templatebuilderavia-shortcodespostslider.php and replace
switch($contents)
{
case "excerpt":
$excerpt = $entry->post_excerpt;
$title = $entry->post_title;
break;
case "excerpt_read_more":
$excerpt = $entry->post_excerpt;
$excerpt .= $permalink;
$title = $entry->post_title;
break;
case "title":
$excerpt = '';
$title = $entry->post_title;
break;
case "title_read_more":
$excerpt = $permalink;
$title = $entry->post_title;
break;
case "only_excerpt":
$excerpt = $entry->post_excerpt;
$title = '';
break;
case "only_excerpt_read_more":
$excerpt = $entry->post_excerpt;
$excerpt .= $permalink;
$title = '';
break;
case "no":
$excerpt = '';
$title = '';
break;
}with
$post_excerpt = $entry->post_excerpt;
if(empty($post_excerpt)) $post_excerpt = avia_backend_truncate($entry->post_content, apply_filters( 'custom_excerpt_length' , 45) , ".", "…", true);
switch($contents)
{
case "excerpt":
$excerpt = $post_excerpt;
$title = $entry->post_title;
break;
case "excerpt_read_more":
$excerpt = $post_excerpt;
$excerpt .= $permalink;
$title = $entry->post_title;
break;
case "title":
$excerpt = '';
$title = $entry->post_title;
break;
case "title_read_more":
$excerpt = $permalink;
$title = $entry->post_title;
break;
case "only_excerpt":
$excerpt = $post_excerpt;
$title = '';
break;
case "only_excerpt_read_more":
$excerpt = $post_excerpt;
$excerpt .= $permalink;
$title = '';
break;
case "no":
$excerpt = '';
$title = '';
break;
}June 5, 2013 at 9:21 pm #122808I tried this in File Manager and it crashed my site. I had to go into FTP and delete the theme and then uploaded a fresh copy to try it again. After trying again, this time in FTP, nothing happened on my site.
Not sure what to do now…?
June 6, 2013 at 1:28 pm #122811Hey!
Yes, my mistake. get_the_excerpt() doesn’t accept an id. I rewrote the code a bit and it should work now.
Best regards,
Peter
June 6, 2013 at 5:52 pm #122812This does fix the missing excerpt for version 1.5.1 but now it’s the same as it was with the previous version…
For example, there’s no rhyme or reason for the default excerpt length, some are 12 lines and some are 5…
TheCaliforniaPost.com
June 8, 2013 at 8:42 am #122813Actually the avia_backend_truncate() will truncate the text content. You can change the length with the custom_excerpt_length filter – add following code to functions.php and change the change the value if required:
add_filter('custom_excerpt_length','avia_change_excerpt_length');
function avia_change_excerpt_length()
{
return 30;
}June 10, 2013 at 5:50 pm #122814I pasted that code at the bottom of the functions.php page and it’s funny how it works bc it doesn’t effect every post, it only effects a few of them. I currently have it set to 80 and you can check my site to see how the excerpts don’t match that number.
My homepage has been created using the Avia Layout Builder using the layer slider at the top and the Blog Post content element with a sidebar at the bottom. Any other thoughts?
June 11, 2013 at 4:36 pm #122815Hi guys,
I saw that you guys dropped the 1.6 update so I installed it and this issue hasn’t been fixed.
I’m under the impression that this is def a theme issue, anyone using the grid layout with the Title and Excerpt chosen and anyone using v1.5 or v1.6 is having the same issue. I’ve tried all of the mentioned suggestions and none of them fix the problem. I really want to use this theme but it’s broken and I’m hoping you guys can fix this really soon.
Isn’t this something that could be fixed in a few hours, add the option to chance the excerpt length in the Avia Layout Builder or Enfold Theme Options panel, and then drop a 1.6.1 update over the next few days?
Thanks for your time.
June 13, 2013 at 5:21 am #122816I just checked the code and version 1.6 already contains the fix – Kriesi added it in wp-contentthemesenfoldconfig-templatebuilderavia-shortcodespostslider.php with following code:
$prepare_excerpt = !empty($entry->post_excerpt) ? $entry->post_excerpt : avia_backend_truncate($entry->post_content, apply_filters( 'custom_excerpt_length' , 45) , ".", "…", true);
This code still checks if you set a manual excerpt (stored in $entry->post_excerpt) and if you set one it won’t use the truncated content – thus the excerpt lengths can vary.
June 13, 2013 at 6:21 pm #122817I just downloaded the newest version of the theme, installed it, and noticed that the drop down in the Avia Layout Builder (under Blog Posts>Define Blog Grid layout) has changed and there are more options now… This is a nice addition but the excerpt is still messed up.
I checked again and the other three Blog Style options have excerpt lengths that are perfect by default. The only layout that has an issue is the grid layout and it’s been this way the whole time.
I don’t understand why the code for the grid excerpt needs to be different from the other three? I’ve tried everything above and the excerpt is still all over the place? I haven’t set a manual excerpt for any of my posts and I’d like you to check my site and look at how awful the layout looks because of the random excerpt lengths…
I don’t want to have to set a manual excerpt for any of my posts and I’d like to be able to just hit post, and the excerpt is automatically taken care of for me just like the other three layout options. Please help!
June 15, 2013 at 10:42 am #122818Ok, I talked to Kriesi and the problem is the logic of the avia_backend_truncate() function. It will not truncate the string unless it reaches a “delimiter” char which can be a space character or a period, etc. At the moment Kriesi uses a period which can result into different excerpt lengths – it simple depends on how long your sentences are. You can change the delimiter char to a space though – then the function can truncate your post content after each word. Open up wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/postslider.php and replace
$prepare_excerpt = !empty($entry->post_excerpt) ? $entry->post_excerpt : avia_backend_truncate($entry->post_content, apply_filters( 'custom_excerpt_length' , 45) , ".", "…", true);
with
$prepare_excerpt = !empty($entry->post_excerpt) ? $entry->post_excerpt : avia_backend_truncate($entry->post_content, apply_filters( 'avf_postgrid_excerpt_length' , 60) , apply_filters( 'avf_postgrid_excerpt_delimiter' , " "), "…", true);
June 17, 2013 at 1:49 am #122819YES!!! I can’t believe you figured it out?! Thank you Dude!!
Now a request… Can you guys please add this to the next update, and add a way in the Theme Options or Avia Layout builder to customize the length of the excerpt? Now that this has been found, I’m under the impression that this addition wouldn’t be that difficult and it would be a nice feature for anyone out there looking to use the Grid Layout. Please let me know your thoughts.
Again, thank you. I’ve used a lot of themes in my day and given the dedication of your support team, I can tell you this theme is as good as it gets! Kudos!
Cheers!
June 17, 2013 at 6:15 am #122820Hey!
Yes, we’ll add an option or a filter – it depends on Kriesi. We’ll also change the delimiter to a space char by default because the period doesn’t make much sense…
Best regards,
Peter
-
AuthorPosts
- The topic ‘Default excerpt length for Grid Layout’ is closed to new replies.