• Hi!

    Since 3 years I have to migrate our current our “cloud server” to the new infrastructure/server.

    But first, I have to migrate to higher PHP version 1 on our website. I finally the time to do it.

    But… I have some problems. We already fixed some but not this one, it’s over my skills.

    The theme is GoodNews from Momizat, it was updated during years, but not anymore since few years.

    On the homepage, we display a box with the last articles. If I choose PHP 8.x there this error over the area:

    Warning: Attempt to read property “term_id” on bool in /home/clients/me/www.my-website.com/wp-content/themes/goodnews5/framework/shortcodes/news-elements.php on line 376

    At the line 376 there is this : $url = get_category_link( $cat_data->term_id );

    I don’t understand the code and really don’t know what to do.
    Please, do you know how to fix this ?

    Thank you 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Yui

    (@fierevere)

    永子

    the best solution would be changin rhe theme to supported one

    Rachid

    (@tartamata)

    The warning means get_category_link() is getting false instead of a valid term ID. Quick fix:

    $url = ( $cat_data && isset( $cat_data->term_id ) ) ? get_category_link( $cat_data->term_id ) : '#';

    Since this is a warning and not a fatal error, you can hide it from the front end by turning off display errors in your wp-config.php file. define( 'WP_DEBUG_DISPLAY', false );

    If the theme is still supported, definitely reach out to them for an official update. If they no longer support it, you will likely see more of these compatibility issues across your site.

    Moderator threadi

    (@threadi)

    This message is not an error but merely a warning. You can also suppress it so that it appears only in the log file and no longer in the frontend. It is difficult to determine whether this has any functional impact, as the warning refers to code in a commercial theme called goodnews5. The developer of this theme has apparently ceased operations several years ago, which leaves you with the following options:

    • Switch to a current theme. These are also compatible with PHP 8. Of course, this may require re-entering content or redesigning the website, which could be quite time-consuming.
    • Or disable the display of PHP warnings in the frontend. This way, they’ll end up in the error log, where they won’t be a nuisance. Be sure to check carefully, though, whether this affects functionality in any way.
    • Or find someone to adapt the theme to PHP 8 for you. You can find someone like that here, for example: https://jobs.wordpress.net
    Thread Starter JeyC

    (@jeyc)

    Thanks to all of you! 🙂

    Rachid, thanks A LOT, it’s working, no more message.

    About the change of the theme: Yes, it should be a good solution, but it’s easier to write to do it, than to do it. We use this theme on many of our websites, it is really good and matching our needs since years, on private or pro website. All website are running on Php 8.2 (we will migrate soon on the new platform) except the one I mention in this topic, the only one to use the this shortcode (to show the list of last articles). We don’t have any problem, all website are running very well.

    Changing a theme is absolutely not possible for us. Changing a theme is taking so much time… we don’t have it. We need to look for one having the good features and style and settings and …, finding one, test it, migrate, adapt, etc

    The website I mention in this topic is not so small, it is running to give lot of information to people for free (like a “community website”), I’m so busy that I have to let if living well like that.
    And I don’t have any money to hire someone, unfortunately…

    Now I still have a problem on the display of this “block” of last article, it is higher on the page in PHP8 than PHP 7.4. Strange.

    If you want to have a look, here 2 screenshots:
    https://zupimages.net/up/26/20/yr52.png
    https://zupimages.net/up/26/20/9mrf.png

    Rachid

    (@tartamata)

    As mentioned above, if the theme is no longer support it, you will likely see more of these compatibility issues across your site.

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.