• Resolved ngrudev

    (@ngrudev)


    Hello,

    I want to make thematic logo and background image for every month of the year. Is there a code to put in functions.php to automaticaly set the logo and back.image depending on the month?

    I have 12 types of logo (logo1.png, logo2.png etc.) and 12 types of back.image (back1.png, back2.png). Depending month number I want the theme to cnage atutomatically the logo and background image.

    For example:
    January – logo1.png and back1.png
    February – back2.png and back2.png

    and so on…

    Thank you,

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi ngrudev

    Thanks for reaching out.

    Anything is possible with custom development. Unfortunately, I don’t know off-hand of a function that could be used for the two tasks you’ve described. I did a quick search for a plugin but couldn’t find one to recommend. Sorry.

    Thread Starter ngrudev

    (@ngrudev)

    I also checked for a plugin, but cant find what i need. It seem to be good idea for development ??

    For the site logo, if you use the Customizer > Site Identity logo then a plugin would work, assuming one existed. For the background it would be trickier, only the boxed layout uses the core WordPress background image, the full-width background image is a theme setting so that would require custom development. Thanks for your feedback, I’ll make a note of it. If we receive further requests we can investigate these features in the future. Sorry, we can’t help at the moment. A service like codeable.io is an option if you wanted to pursue the custom development route. Thanks for your understanding.

    Thread Starter ngrudev

    (@ngrudev)

    Thanks for your attention and having in mind the idea. I appreciate it!

    I will be happy to see this functionality in future.

    Thank you!

    Thread Starter ngrudev

    (@ngrudev)

    I think I made it. It worked perfectly. Now I will make a cron sheduler to run the function every day to save resourses.

    //auto change logo and masterhead background image depending on month
    add_action('init', 'update_logo');
    function update_logo() {
    	$month = date("n");
    	$my_fields = get_option('theme_mods_vantage-child');
    	if ($month == 12 || $month == 1 || $month == 2) { 
    		$logo = 7078; //christmas logo post ID
    		$retina_logo = 7077; //christmas retina logo post ID
    		$background = 'https://images2.luga.bg/2016/12/back_1080_christmas.jpg'; //christmas masterhead background image url address
    	}
    	else { 
    		$logo = 6979; //standard logo post ID
    		$retina_logo = 6981; //standard retina logo post ID
    		$background = 'https://images2.luga.bg/2016/12/back_1080.jpg'; //standard masterhead background image url address
    	}
    	$my_fields['theme_settings_logo_image'] = $logo;
    	$my_fields['theme_settings_logo_image_retina'] = $retina_logo;
    	$my_fields['vantage_page_masthead_background_image'] = $background;
    	update_option('theme_mods_vantage-child', $my_fields);
    }

    Awesome! Really glad to hear you were able to write something for the job. Thanks for sharing ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Auto change logo and background image every month’ is closed to new replies.