Excerpt length in services - how to remove truncation?

Hi,
Is there a way to remove truncation from pages content that is listed in “Services” section?
I need to show full content of the pages assign to services.

Please advice,
Marcia

Hello there,

Services widget by default retutn 12 words. You should be able to display full content by changing marked function here theme folder / inc / framework / widgets / front-services.php with http://screencast.com/t/HZlSzaeDuJH the_content https://developer.wordpress.org/reference/functions/the_content/

Best Regards!

Thank you! It worked. :slight_smile:

Following on from @dimikjones comment above.

Here’s what I did:

  • Add a hidden element to the service page
  • Create a function that loads the service page, parses out the description, and removes the hidden style
  • Call this function

Create function:

		// Pulls the service description from the service page.
		// 
		// Example of description in the `text` part of the service page:
		// <span style="display: none;">Service Description here.</span>
		// 
		// This description won't show on the service page because of the `display: none;` span
		// 
		// This function parses this description and removes the span.
		function getServiceDesc() {
			$serviceContent = get_the_content();
			$endTag = '</span>';
			
			$serviceDesc = substr($serviceContent, 0, (strpos($serviceContent, $endTag)));
			$serviceDescStripped = strip_tags($serviceDesc);

			return $serviceDescStripped;
		}

Add is above the following line:

if ($services->have_posts()) :

Replace this line:

<?php echo wp_trim_words( get_the_content(), 12 ); ?>

With this line:

<?php echo getServiceDesc(); ?>

Then you can add a service description in the service page (text mode, not visual) like so:

<span style="display: none;" id="service-desc">Everything from calm narration to excitement that will capture your audience's interest.</span>