• Resolved indregud

    (@indregud)


    Hello,
    I have excerpts on pages same as on posts.
    In your widget display settings I select to show excerpts. It does, when there’s post listed, but it doesn’t if pages are listed. It only shows “…”
    What I want to achieve is for excerpts of my pages in listed view to be visible.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author piccart

    (@piccart)

    hello!
    I am so sorry I don’t know why but I missed the notification for this post.. ??

    Pages don’t have the excerpt by default, hence it means that some custom code (from a plugin, theme, etc..) is adding that feature to your pages.

    if it’s added as an actual wp post excerpt, then it should display with my plugin, because the function is the same. But if it’s added in other ways (i.e. as a custom fields) then it won’t be recognised as excerpt and my plugin will pull nothing..

    could you send me a screenshot of the place where you input the excerpt for pages in the admin?

    edit: actually, I just had a better look and my plugin builds the excerpt starting from the_content (that’s to allow any length as you set in the options).
    To avoid breaking code in half when trimming the excerpt length from the content, the plugin strips all shortcodes and other html too before trimming.
    What do you have as Page content? is it some sort of visual page builder?

    • This reply was modified 6 years, 11 months ago by piccart.
    Thread Starter indregud

    (@indregud)

    Hi,
    yes, my page content is on visual builder, but excerpt comes before it (it works perfectly on posts, which are all also done with page builder)

    it is added the same way as post excerpt ( I just added
    add_post_type_support( 'page', 'excerpt' ); to my functions file). That’s why i cannot wrap my head around it :/

    • This reply was modified 6 years, 11 months ago by indregud.
    Plugin Author piccart

    (@piccart)

    I don’t know why, but I don’t receive the notifications for this topic… sorry!

    I’ve investigated a bit the situation and the problem is that when the code strips the shortcodes from the content, it will strip everything if it’s inside an open shortcode.

    so by instance this:
    [shortcode]Some content here that will be rendered in some custom way[/shortcode]

    would result in nothing to show…

    Visual page builders usually works printing out sets of shortcodes, with visual composer by instance you can switch to classic editor and you’ll see how the content actually look.

    in any case, I’ve updated the plugin and changed the code so that if it’s not able to build a valid custom excerpt starting from the content, it will look for the actual wp excerpt.
    That obviously would work only for post types which actually have the support for excerpt.

    about this matter, be aware that you must fire the add_post_type_support() from within a function hooked to init. this is the complete and correct snippet that you need in your functions.php

    function wpcodex_add_excerpt_support_for_pages() {
    	add_post_type_support( 'page', 'excerpt' );
    }
    add_action( 'init', 'wpcodex_add_excerpt_support_for_pages' );

    let me know if this will fix your problem.

    Thread Starter indregud

    (@indregud)

    Hi, i already had the script up and running ??
    It started to work after i installed updated plugin! Thanks for all your help!

    Plugin Author piccart

    (@piccart)

    perfect!

    have fun, and maybe rate the plugin if you have 2 minutes. ??

    thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘page excerpt does not show’ is closed to new replies.