Content trimming for services and timeline

Hi! Two questions: I can avoid the limitation of 12 words displayed in the services text description modifying front-services.php and modifying the wp_trim_words(…) second parameter for whatever I want or even to publish the whole post with get_the_content() as I finally did. The first question is: Can I modify that on my child theme (I think the answer is no…) in order to avoid the risk of overwriting this change in the case of a future update? The second is, what file should I change in order to achieve the same for my timeline items? I can’t figure it out…

Thanks in advance!

Hi,

  1. You actually can. First, to make things easier grab the new code for the functions.php file as I assume you’re not using the latest version of the theme: http://pastebin.com/Q3hgPaZf
    The only change from the initial version is in that file.
    After that simply copy the file and use the same structure in your child theme /inc/framework/widgets/front-services.php. This way the file we’ll be loaded from your child theme.

  2. The timeline widget is in the plugin, not in the theme. Note that the same principle from above won’t apply as the files are loaded differently. The theme was recently changed to a different system for loading widgets and after some testing the plugin will be too.

Note: you mentioned get_the_content(). Keep in mind that you have to escape it for safety, not just echo it. You might as well use the_content() which you don’t need to escape.

Forgot to mention: make sure you overwrite the functions.php content from FTP, not from the editor.

Hi Vlad!
It works perfectly but after updating the functions.php file. Why I didn’t received any notification of changes in the parent theme? And yes, I’ve used the_content(), thanks for the detailed follow up.

So what do you recommend me about the timeline then? To change it manually in the plugin by now until the new one is ready?

There are no notifications or automatic updates until the theme goes live on wordpress.org. That will take a while as the queue is pretty big.

Yeap, change it in the plugin directly for now.

Cool I’ll do that. Thanks!

So I’ve updated the plugin, you should have an update notice. You can now use the same principle as above, just see that the folder structure is different in the plugin and you need to keep it.

I’m also running the timeline content through a filter now so if you want to do it even easier you can just add something like this in your child’s functions.php:


function astrid_override_timeline() {
	return the_content();
}
add_filter('astrid_pro_timeline_content', 'astrid_override_timeline');

This way you don’t have to override the whole widget.

Oh man… you’re my kind of hero!!! :wink: Updated and working as advertised. I’ll take a look to the plugin to see what else can be done.

Congratulations and thanks Vlad! :slight_smile: