Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author caterhamcomputing

    (@caterhamcomputing)

    I’m afraid that styling in the excerpt is not possible.

    The shortcode uses WordPress’ own functionality to generate excerpts where a page’s excerpt is empty.

    Any formatting is stripped from the content before it is trimmed down (to avoid ending up with HTML tags that are opened but not closed because the closing tag is after the cut-off point).

    This is the same way that excerpts work for all post types.

    See https://codex.www.ads-software.com/Function_Reference/get_the_excerpt and https://codex.www.ads-software.com/Function_Reference/wp_trim_excerpt for more information about how excerpts are generated.

    Plugin Author caterhamcomputing

    (@caterhamcomputing)

    Hi. This isn’t a 100% fix for your situation, but I’ve made some small changes to the way the plugin handles excerpts.

    Generated excerpts (where no custom excerpt has been entered for the page) will still be stripped of their HTML tags (for the reasons outlined above), but custom excerpts will now only be passed through wp_trim_excerpt (which would remove HTML) if they are longer than the specified word count (55 by default, set using the words parameter: [child_pages words="255"]).

    When combined with the Rich Text Excerpts plugin, this should mean that you can specify formatted text as a custom excerpt for each page.

    (You will need to add the rich text editor to the pages post type using the settings in the Rich Text Excerpts plugin, as pages do not have excerpts by default – my plugin adds that functionality.)

    I will look at refining this solution in the future, but hopefully this will help in the meantime.

    Plugin Author caterhamcomputing

    (@caterhamcomputing)

    Plugin Author caterhamcomputing

    (@caterhamcomputing)

    I have just released a new version of the plugin which includes a new parameter for the shortcode:

    You can stop Custom Excerpts from being truncated by seting the truncate_excerpt parameter to “false”:

    [child_pages truncate_excerpt="false"]

    … this will display custom excerpts exactly as entered without being shortened. (Especially useful if using the Rich Text Excerpts plugin, in which case all styling will be preserved.)

    Thread Starter EmperorFPM

    (@emperorfpm)

    awesome.
    Thanks

    Plugin Author caterhamcomputing

    (@caterhamcomputing)

    I’m marking this as resolved now. I have provided a way to have styled excerpts, and the rest of the behaviour is consistent with standard WordPress functionality.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Excerpt Styling’ is closed to new replies.