Critical error

  • Author
    Posts
  • BrownC

    Hi ihor,

    whenever I try to edit my homepage it gives me this error next to hivepress plugin

    Deactivate | Resume
    Multipurpose directory, listing & classifieds plugin.

    Version 1.3.6 | By HivePress | View details
    This plugin failed to load properly and is paused during recovery mode.

    An error of type E_ERROR was caused in line 229 of the file /home/brownpag/public_html/wp-content/plugins/hivepress/includes/models/class-model.php. Error message: Uncaught BadMethodCallException in /home/brownpag/public_html/wp-content/plugins/hivepress/includes/models/class-model.php:229 Stack trace: #0 /home/brownpag/public_html/wp-content/plugins/code-snippets/php/snippet-ops.php(446) : eval()’d code(7): HivePress\Models\Model->__call(‘claim_listing’, Array) #1 /home/brownpag/public_html/wp-includes/class-wp-hook.php(287): add_custom_verified_badge(Array, Object(HivePress\Templates\Listing_View_Block)) #2 /home/brownpag/public_html/wp-includes/plugin.php(206): WP_Hook->apply_filters(Array, Array) #3 /home/brownpag/public_html/wp-content/plugins/hivepress/includes/templates/class-template.php(118): apply_filters(‘hivepress/v1/te…’, Array, Object(HivePress\Templates\Listing_View_Block)) #4 /home/brownpag/public_html/wp-content/plugins/hivepress/includes/templates/class-template.php(98): HivePress\Templates\Template->boot() #5 /home/brownpag/public_html/wp-content/plugins/hivepress/includes/templates/class-listing-view-block.php(165): HivePress\Templates\Template->__

    ihordeveloper

    It’s caused by a custom code snippet suggested in this topic https://hivepress.io/support/topic/hide-reply-to-listing-function-for-certain-listings/#post-2364 There should be “is_claim_listing” instead of “claim_listing”, please try using this snippet if a custom badge is still required:

    add_filter( 'hivepress/v1/templates/listing_view_block/blocks', 'add_custom_verified_badge', 10, 2 );
    add_filter( 'hivepress/v1/templates/listing_view_page/blocks', 'add_custom_verified_badge', 10, 2 );
    
    function add_custom_verified_badge( $blocks, $template ) {
    	$listing = $template->get_context( 'listing' );
    
    	if ( $listing && $listing->is_claim_listing() ) {
    		$blocks = hivepress()->helper->merge_trees(
    			[ 'blocks' => $blocks ],
    			[
    				'blocks' => [
    					'listing_title' => [
    						'blocks' => [
    							'claim_listing_badge' => [
    								'type'    => 'content',
    								'content' => '<i class="hp-listing__verified-badge hp-icon fas fa-check-circle" title="Custom title here"></i>',
    								'_order'  => 100,
    							],
    						],
    					],
    				],
    			]
    		)['blocks'];
    	}
    
    	return $blocks;
    }
    BrownC

    Thank ihor

    this worked perfectly. The attribute works but not as a badge, it assigns a ‘yes’ to the listing sidbar when selected on admin dashboard

    ihordeveloper

    I tried adding the same attribute and code snippet locally (please check if it’s slug is “claim-listing”) https://prnt.sc/sc4zig and it adds a custom badge next to the listing title when checked. If it appears in the sidebar then it’s assigned to the “Page (primary)” display area.

    BrownC

    THANKS IHOR!

    It’s working now. I only want to change the colour of the badge to grey

    ihordeveloper

    You can change it in on this line from the code snippet above:

    'content' => '<i class="hp-listing__verified-badge hp-icon fas fa-check-circle" title="Custom title here" style="color:grey"></i>',

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

Subscribe

Sign In

Don't have an account? Register

Forgot password?

Register

Already have an account? Sign In

Forgot password?

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.