Cornerstone/Theme X code displayed in search results

I’ve got a problem with a Contact page ending up in search results looking like this:

The Home-page which is also designed using Theme X page builder is displayed alright when I search for it.

You can try searching on this page:
https://keiretsuforumnordics.com/blog/

… either for “Contact” which will show you the problem
… or using “Home” which will show you a normal excerpt from a page builder page

The site is using WP 5.4 which I know is not fully supported yet, but why do one page work and not the other?

I’ve made sure the page is edited in the Code editor, and have implemented a Theme X fix from this thread After Wordpress 5.4 Update Pro is Malfunctioning

Login to the development site is attached in the Secure note.

Best,
Petter Stahre

Hi @birdycom,

Thank you for writing in, that error seems to be coming from your contact form. Please check your contact form for any malformed HTML markup.

Also, please do testing for a plugin conflict. You can do this by deactivating all third party plugins, and seeing if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.

Cheers!

Thanks for your reply but unfortunately disabling all plugins didn’t do the trick.
And the Contact form (Ninja Forms) does not contain any custom HTML (and was also disabled totally, without any positive changes).

What more can I try?

Best,
Petter

Hello Petter,

The search results displays excerpts. The excerpts only displays the first 55 words in your post/page contents. If you used Cornerstone in building the page, the Cornerstone formatting shortcodes will be displayed instead. To prevents from happening, you will need to insert manual excerpts for your posts and pages. To know more about how you can make use of the Manual Excerpts, please check this out:
https://codex.wordpress.org/Excerpt#How_to_add_excerpts_to_posts

And since pages, does not have an excerpts by default, you will have to hack Wordpress to be able to insert a page excerpt. Please check out this link to guide you to do it:

You’ll have to add excerpt for those pages. Please do this,

  1. Add this line to your child theme’s functions.php

add_post_type_support( 'page', 'excerpt' );

This is needed for page type since it doesn’t have excerpt by default

  1. Edit your page or post and scroll to very top and click Screen Options , make sure Excerpt is toggled on
  2. Scroll down and find Excerpt meta box section and there, add your text excerpt.

Hope this helps.

Thanks, I’ll try that.

But if that’s the solution, how come the Homepage shows a readable excerpt without this added functionality?

This is what it looks like now (before making any changes) when I search for “home”:

… the text is only made in the theme X page builder.

Best,
Petter

Hi Petter,

Wordpress generates plain text when displaying excerpt, it will remove all shortcodes and HTML. But some could bypass if it contains malformed content, or other 3rd party plugins is appending some content. The solution is adding text excerpt manually as stated on previous reply.

Hope this helps.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.