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

    #574946

    Hi 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,
    Basilis

    #574964

    Thanks. I’ll look for your reply. :-)

    #576896

    Hi!

    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">  &rarr;</span></a></div>';
    		$content = $get . $readmore;
    	}
    
        return $content;
    }
    

    Best regards,
    Ismael

    #576911

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

    Hi!

    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,
    Ismael

    #578217

    Yes, 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.

    #579148

    Hey!

    Glad we could help. :)

    Regards,
    Ismael

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Blog Category views differ from Post to custom post type’ is closed to new replies.