Skip Navigation

[Resolved] Conditional Output Solution provided not working.

This support ticket is created 4 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by AtefR7377 4 years, 11 months ago.

Assisted by: Nigel.

Author
Posts
#1402383

Hi,
referring to this support thread:
https://toolset.com/forums/topic/conditional-output-if-the-post-content-is-filled/

I found out that the provided solution gives me the following error in the php-error.log:

 PHP Warning:  count(): Parameter must be an array or an object that implements Countable in /home/s1/html/wp-content/plugins/coptic-treasures-functions/functionality-plugin.php on line 704

Line 704 is this:

            $return = count($object->post_content);

Can you please help me fixing this problem?
Thanks.

#1402785

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Looks like a mistake in the code, count() is used to count the number of elements in an array, but $object->post_content would be a string.

That line should probably be:

$return = strlen($object->post_content);
#1402849

My issue is resolved now. Thank you!