Category images instead of icons

Hi.

I tried changing my icons for categories in ExpertHive to Pictures to Make Users Understand more about the categories. I tried putting this image to one of the categories but it appeared in all the categories. see both images


please how do i go about adding pictures to the icons of different categories. can you help me with code snippet to go about this please :pray:

  1. Please how can i put REQUESTS in a the home page. like maybe create a block in the home page and put REQUESTS in a child Theme so that user can see some or recent REQUESTS to have a clue before selecting the request options

@yevhen

1 Like

Sorry for the late reply, I’ve been trying to find a simple snippet for this but it’s not possible, you can do this only by overriding the category image template part and also adding the Image field to the back-end category form, then using the uploaded image URL. You can check this tutorial if it helps Customizing Templates I HivePress Developer Docs - YouTube You can also keep icons and check if there are icons matching your category subjects Line Awesome — Free Beautiful Icon Font

Adding requests to the home page doesn’t require any code customizations, please try using the Requests block in the same way as the Vendors block is inserted.

Thanks @ihor i really appreciate your help.

I really want to add pictures to my category icons. You said I can do this only by overriding the category image template part and also adding the Image field to the back-end category form, then using the uploaded image URL.

To be honest I’m confused and the tutorials didn’t help. Can you please break it down for me to understand in a more simpler way so I can do it myself. Like step by step process. How do I add the image field to the back end category form and how do I upload different images for different categories. :pray:t4:

@ihor

If you already created a template part that overrides the category icon, please use this code in the image src attribute:

<?php echo esc_url( $listing_category->get_image__url( 'thumbnail' ) ); ?>

Then you can try using this code snippet to add the category Image field to the back-end category form:

add_filter(
	'hivepress/v1/meta_boxes/listing_category_settings',
	function($config ) {
		$config['fields']['image']=[
				'label'   => 'Image',
				'caption' => 'Select Image',
				'type'    => 'attachment_select',
				'formats' => [ 'jpg', 'jpeg', 'png' ],
				'_order'  => 10,
			];

		return $config;

	}, 1000
);

Thanks @ihor i really appreciate. It worked on my laptop but it’s still the same icons on my mobile phone.

Look at how i placed the code incase i didn’t put it correctly

and the sample images i used displayed on the category icons but not on mobile phone

please help

Please make sure that the website is not cached on mobile, if this issue persists please send a link to it and I’ll check this, there’s probably a simple CSS fix.

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