Support » Themes and Templates » Adding Different Backgrounds to Different Sections Using Add_Custom_Background

  • Hi there,

    I am wondering if it is possible to use add_custom_backgrounds (or add_theme_support in 3.4) for different sections. For instance, let’s say I want to have a one background color for the body and another for the header section.

    Is it possible to set up add_custom_backgrounds so that I can individually set values for each one?



Viewing 2 replies - 1 through 2 (of 2 total)
  • You can only have one instance of add_custom_background or add_theme_support) but certainly in the case of the former, there’s nothing to stop you writing your own custom callback function to apply different background to different page elements. I’ve used that approach to apply a background to (say) the html element instead of the body. But the downside is that you’ll still only get a single custom background form, so the user can only customise the background on one element.

    Thanks for replying – I actually didn’t notice that someone did reply :).

    If I understand what you are saying correctly, I can pass arguments to add_custom_background to change what it modifies, but I can’t pass any arguments to it so that it will modify more than one element – is that correct?

    If so, then perhaps I could modify the add_custom_background function to accomplish what I want – i.e., to create a multi_add_custom_background function? My only question would be on how to actually do that – any ideas?

    Thanks and be well,


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding Different Backgrounds to Different Sections Using Add_Custom_Background’ is closed to new replies.