• Resolved Rupesh

    (@krreddy1)


    Hi,

    I created child theme based on leaf theme with following folder structure.
    LeafChild > images [folder], style.css.

    In images folder > no-image.jpg, no-image-small.jpg

    If a post does not have any images, it is using these no-image.jpg, no-image-small.jpg files from parent theme. So i modified these images with other images and placed them in my child theme with same folder structure.

    LeafChild> images > no-image.jpg, no-image-small.jpg

    But when i publish a post with out images, it is still using no-image.jpg from leaf theme instead of using no-image.jpg from LeafChild.

    so how can i make my child theme to use images present in child theme folder instead of using them from parent theme.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The function that gets the placeholder image uses
    get_template_directory_uri() – which returns the parent directory instead of
    get_stylesheet_directory_uri() – which returns the child theme directory.

    To fix this, open up includes/theme-plugins.php, copy the leaf_get_post_image function and paste it into your child theme functions.php. Then change every instance of get_template_directory_uri() to get_stylesheet_directory_uri() . Save file, upload, and Voila!

    Thread Starter Rupesh

    (@krreddy1)

    Thank You @webmystery, Now it taking images form child theme instead of parent theme.

    Thanks! ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to replace theme images by using child theme ?’ is closed to new replies.