-
AuthorPosts
-
January 30, 2016 at 7:41 am #574918
I’m wondering if you have a solution to this. The view that I get when I create a Blog page with a category that is from a Post will display the featured image and the excerpt only. This view is fine.
However, the view that I get when I create a Blog page with a category that is from a custom post type (“itineraries”) displays all the content of the post. I’d like the later to be like the former.
I have example links in Private Content.
I used Types to manage the custom post types (which was recommended by one of your moderators).
Thanks so much,
January 30, 2016 at 9:19 am #574946Hi laptophobo!
That is a first. I checked also my installation and I have seen the same thing.
I did not found a solution to be honest, but there might be something around.
I have asked a colleague to come and give it a look, if he can have something to be suggested.Regards,
BasilisJanuary 30, 2016 at 10:09 am #574964Thanks. I’ll look for your reply. :-)
February 3, 2016 at 6:35 am #576896Hi!
What if you use the read more tag for the custom post type items? Or try this plugin: https://wordpress.org/plugins/advanced-excerpt/
OR add this in the functions.php file:
add_filter('the_content', 'the_content_more_link', 10, 1); function the_content_more_link($content) { if( is_archive() ) { $content = get_the_content('', ''); $get = substr($content, 0, 100) . "..."; $readmore = '<div class="read-more-link"><a href="'.get_permalink().'" class="more-link">'.__('Read more','avia_framework').'<span class="more-link-arrow"> →</span></a></div>'; $content = $get . $readmore; } return $content; }
Best regards,
IsmaelFebruary 3, 2016 at 7:06 am #576911When the Advance Excerpt plugin is activated, the Post (e.g.: news) works as it should, but for the Custom Posts (e.g.: nepal), I get this error message and no content: Notice: Undefined index: index in /home/karnalie/public_html/ke-2016/wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/google_maps.php on line 281
So, I’ve deactivated the plugin and went with your functions.php code. If you go to the Nepal blog, you’ll see that there’s a problem with this as well.
As for activating the Read More tag, per your first solution, I don’t know what that means.
Thanks again,
- This reply was modified 8 years, 10 months ago by laptophobo.
February 4, 2016 at 12:19 pm #577723Hi!
Did you build the content of the custom posts with the advance layout builder? If yes then you will not be able to define the excerpt using the more tag. ( https://en.support.wordpress.com/more-tag/) Edit the posts then add the summary in the Excerpt field. If it doesn’t work, modify the includes > loop-index.php file then look for this code:
if(AviaHelper::builder_status($current_post['the_id']) && !is_singular($current_post['the_id']) && $current_post['post_type'] == 'post')
.. replace it with:
if(AviaHelper::builder_status($current_post['the_id']) && !is_singular($current_post['the_id']) && $current_post['post_type'] == 'post' || $current_post['post_type'] == 'itineraries' )
Don’t forget to disable the plugin and remove the code in the functions.php file. If you don’t want to modify the original template files, you can create your own archive templates: https://developer.wordpress.org/themes/basics/template-hierarchy/#custom-post-types
Best regards,
IsmaelFebruary 5, 2016 at 4:39 am #578217Yes, replacing the line of code in the loop-index.php file worked. Thank you for that. And I’ll look into the “create your own archives templates” thread next.
Thanks again for your help with this: Ismael and Basilis.
February 7, 2016 at 9:15 am #579148 -
AuthorPosts
- The topic ‘Blog Category views differ from Post to custom post type’ is closed to new replies.