[resolved] Change default image for posts without featured image in slider (3 posts)

  1. optimalhuman
    Posted 2 years ago #

    Hi Rajeeb and All,

    First of all, great theme, thanks for all your hard work!

    I'm using Techism with a child theme over at my blog http://www.optimalhuman.co.uk. I've just started playing with the slider functionality which looks great.
    I've managed to customise it by changing 'styles.css', but one thing I've not managed to do is to work out how to change the default image for posts that do not have a 'featured image' set.

    I have a temporary workaround: I have created a new category called 'Featured' and applied this to all the posts that I want to show up in the slider, then set the slider settings to use this as the featured category.
    However, I have posts that I want to show up in the slider, but they don't have a featured image and they are unlikely to get one, so I'd really like to be able to change the default image, or just show a coloured background.

    I can see that it would be easy enough to do by editing 'content-slider.php', but I don't really want to edit the theme directly and would rather make the changes in my child theme.

    Any ideas how I can go about this in 'styles.css' or 'functions.php'?

    Many thanks in advance,

  2. Rajeeb Banstola
    Theme Author

    Posted 2 years ago #

    Hello @optimalhuman

    Thanks for using Techism theme :)

    According to the current theme functions declarations, I don't think It would be possible to change the default image without directly editing the 'content-slider.php'

    For the current scenario, I would recommend changing the below line no. 12 in 'content-slider.php' :

    <img src="<?php echo get_template_directory_uri(); ?>/assets/images/thumbnail.png" alt="Default Thumbnail" />


    <img src="http://your-site.com/images/thumbnail.png" alt="Default Thumbnail" />

    Make sure you replace 'http://your-site.com/images/thumbnail.png' with proper image url.

    I assure you the setting for changing default image will be added in upcoming version of Techism theme.

    Thank you again :)

  3. optimalhuman
    Posted 2 years ago #

    Hi Rajeeb!

    Firstly, sorry for my slow reply - I've been on holiday and out of email range for a while (I'll be making a blog post about my experiences soon :-) )

    Thank you very much for your support and the detailed reply. I'll make those changes to 'content-slider.php' and eagerly await the next release of Techism :-)

    Thanks again,

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic