WordPress.org

Ready to get started?Download WordPress

Forums

Adding Different Backgrounds to Different Sections Using Add_Custom_Background (3 posts)

  1. Moshe
    Member
    Posted 2 years ago #

    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?

    Thanks,

    Moshe

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    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.

  3. Moshe
    Member
    Posted 2 years ago #

    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,

    Moshe

Topic Closed

This topic has been closed to new replies.

About this Topic