Service widget more than two lines


#1

Hi,

Is it possible to have more than two lines on this widget ? I need three or four lines.

Thanks


#2

Hello,

Did you try to add more services? They should appear automatically if you have set -1 value for Number of services to show option in widget settings.

Kind Regards, Roman.


#3

Oops, I misunderstood. I can’t put text on more than 2 lines in each service, it is truncated.


#4

Hello,

You can edit inc/framework/widgets/front-services.php file using a text editor and replace this line:
<?php echo wp_trim_words( get_the_content(), 12 ); ?>

…with this:
<?php echo get_the_content(); ?>

You should override modified .php file using a child theme to avoid losing your changes after theme update.

Please feel free to ask any other questions that you might have.

Kind Regards, Roman.


#5

Thanks a lot, I look at this this week. I need to see how I can override the php file using a child theme.

Regards Guik


#6

You are welcome Guik,

For that particular file you should create three folders recursively in child theme folder:
inc/framework/widgets/, then put modified widget file there.

You can learn more about child themes on this WordPress Codex page:
https://codex.wordpress.org/Child_Themes

Kind Regards, Roman.


#7

I thanks for all, I will test this


#8

Okay, you are welcome Guik!

Kind Regards, Roman.


#9

Perfect tipp Roman, thank you! I was just wondering:what if I don’t want to show the text at all? Normally I would use CSS to not display the class, but in this case the class includes the headline of the service (which I want to display).

So can i simply do this?
<?php echo wp_trim_words( get_the_content(), 0); ?>

Thank you!


#10

Hello, in your case you can just remove that row I think.

Kind Regards, Roman.


#11

Ok, but since I don’t want to touch the themes code, I have to handle it in my child theme. There I can’t tell the main theme to ignore a line, can I? So I’d have to overrule it?

Thanks, Alex


#12

Yes Alex, you’ll have to modify the .php file and override it in a child theme like I described above.

Kind Regards, Roman.


#13

@roman I test your solution, it’s ok for me. Thanks a lot


#14

Great! You are welcome Guik :slight_smile:

Kind Regards, Roman.


#15