Hello @mstudioil,
In this case, you need to customize the theme;
Before it, you should use the child theme: https://docs.oceanwp.org/article/90-sample-child-theme.
Note: Please make sure to get a full backup from your website; then do the following steps.
Step 1: Use the function below in the OceanWP Child theme > function.php
/**
* Alter your page header background image
*
*/
function my_page_header_bg_img( $bg_img ) {
if ( is_product_category() ) {
global $wp_query;
$cat = $wp_query->get_queried_object();
$thumbnail_id = get_term_meta( $cat->term_id, 'thumbnail_id', true );
$image = wp_get_attachment_url( $thumbnail_id );
}
// Retrun
if ( $image ) {
return $image;
} else {
return false;
}
}
add_filter( 'ocean_page_header_background_image', 'my_page_header_bg_img' );
Step 2: Now, please put the CSS below in Customizing > Custom CSS/JS > CSS Code:
and this CSS:
.tax-product_cat .page-header {
background-size: cover;
background-position: center center;
}
For more information about the CSS/JS code on the customizer, please read this link:
https://docs.oceanwp.org/article/354-add-custom-css-and-js-to-your-website.
Step 3: After doing the above steps, navigate to the WP Dashboard > Products > Category. Edit/Add your desired category item and set a featured image.
Please check these screenshots: https://postimg.cc/gallery/mg4YZVZ.
Note: if you have any cache plugin or server cache(CDN / Browser Cache and Cookies and …), you need to clear its cache contents or disable them to see your changes. Also, don’t forget to click on the regenerate all assets file and data in Elementor > Tools.
Best Regards
Thanks, I will test it.
It mean I need to click on the image in order to edit it?
Hello @mstudioil,
Sorry, but I’m not getting the exact point.
– After adding the code above, you just need to upload a featured image for your desired category. Then you’ll see something like this: https://i.postimg.cc/XNXyTB0c/004.png.
Best Regards
Thanks for the answer, I asked where do I upload the image, I didn’t get it from the screenshot
Hello @mstudioil,
You can follow step 3 in the previous reply:
Please navigate to the WP Dashboard > Products > Category.
Edit/Add your desired category item and set a featured image: https://i.postimg.cc/cJMXQcm3/image.png.
Best Regards
OK, so it is the same image I using on the categories page