Problem with x/framework/functions/portfolio.php on line 411

Hi,

My error log is overwhelmed with PHP Notice: Trying to get property of non-object in wp-content/themes/x/framework/functions/portfolio.php on line 411.

I tried solving the problem as described here:

But the errors continue to show up.

Can you let me know what I can do about this? It seems to be causing too much CPU consumption for Siteground. Perhaps just turning off the Debug will solve that issue?

site: savethepostoffice.com
WP version: 5.1.1.
X: 6.5.5
Cornerstone: 3.5.4

By the way, if it helps, here’s the code that’s referenced (which you probably already know):

if ( get_transient( ‘x_portfolio_slug_before’ ) != get_transient( ‘x_portfolio_slug_after’ ) ) {
flush_rewrite_rules( false );
delete_transient( ‘x_portfolio_slug_before’ );
delete_transient( ‘x_portfolio_slug_after’ );

Hello Steve,

I can confirmed that this is a conflict in the latest update release. Our developers has been informed about the issue. This shall be fixed in the next release update cycle. meanwhile, you can add this temporary resolution in your child theme’s functions.php file. This code will not create conflict or intervene any of the previous and/or future releases.

// Entry Class
// =============================================================================

if ( ! function_exists( 'x_portfolio_entry_classes' ) ) :
  function x_portfolio_entry_classes( $classes ) {

  	if ( is_page_template( 'template-layout-portfolio.php' ) ) {
	    GLOBAL $post;
	    $terms = wp_get_object_terms( $post->ID, 'portfolio-category' );
	    foreach ( $terms as $term ) {
	      $classes[] = 'x-portfolio-' . md5( $term->slug );
	    }
	}
	
    return $classes;

  }
  add_filter( 'post_class', 'x_portfolio_entry_classes' );
endif;

We would love to know if this has worked for you. Thank you.

Thanks for your help. I think that may have done the trick. So far so good, anyway.

Glad it’s working now and you’re most welcome!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.