Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello @iwaaleksey2011,

    Thank you for reaching out,

    This PHP code is another version you can modify:

    /**
     * Alter your page header background image
     *
     * Replace is_singular( 'post' ) by the function where you want to alter the layout
     * Place your image in your "img" folder
     */
    function my_page_header_bg_img( $bg_img ) {
    
    	if ( is_product_category( 'category' ) ) {
    		$bg_img = 'https://www.example.com/img/demo-011.jpg';
    	}
    	// Retrun
    	return $bg_img;
    }
    add_filter( 'ocean_page_header_background_image', 'my_page_header_bg_img' );

    Screenshot: https://postimg.cc/LgqRp9ch.

    I hope it helps.
    Best Regards

    Thread Starter iwaaleksey2011

    (@iwaaleksey2011)

    Hello, this works if you turn on the settings – general settings – title – style – background image.
    But this includes a background image on the entire site.

    Category
    Screenshot: https://i.postimg.cc/pXfqkhfT/1.png

    Single product
    Screenshot: https://i.postimg.cc/d3ttXT7Y/2.png

    Thank you, I will change styles in a single product
    Screenshot: https://i.postimg.cc/jSZVgkHL/3.png

    Hello @iwaaleksey2011,

    Thank you for reaching out,

    To have a background image for the page title you must enable the background image for the whole website before: https://postimg.cc/JyzSq5jX and also, you can add a default image.
    Then add that function to assign the category’s image to the page title.
    Also, you can set the image from the specific page: https://postimg.cc/F13C0Bwq.

    To test it you can remove that function and check the site. So that function cannot affect the website. That is related to the settings of the page title.

    If you want to change its style, then you must customize the theme.

    Furthermore, there is a condition in the function you can modify it.
    I used is_product_category( 'category' ) and will work only on “category” which is in product categories, so you must add other images for different categories.

    ________

    Customization theme:

    Before it, if you are unfamiliar with PHP, you can contact a PHP expert.
    Start with installing the child theme. Then, by using FTP or cPanel access (if didn’t use the localhost), Go to this directory: wp-content\themes\oceanwp\partials
    Find the template that you want to customize and copy that template file.

    Then head over to the same path on the child theme. There isn’t an entry folder as a default on your child theme, so you need to create a new one(one time).

    Paste that template there.
    Then you can edit the template on the new path in the child theme: wp-content\themes\oceanwp-child-theme\partials

    * Please check this screenshot: https://i.postimg.cc/sxjYTWyt/image.png.
    * Download child theme: https://docs.oceanwp.org/article/90-sample-child-theme.
    * Developer docs: https://docs.oceanwp.org/collection/19-developer-doc.

    Note: It’s working with the /woocommerce/ folder or root of the theme files.

    I hope it helps.
    Best Regards

    Thread Starter iwaaleksey2011

    (@iwaaleksey2011)

    Hello, thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.