WordPress.org

Ready to get started?Download WordPress

Forums

Cant get add_custom_background(); to work (4 posts)

  1. Meiioo
    Member
    Posted 1 year ago #

    I am stuck at add_custom_background.

    I can change background color/image but I only want to change my index page. Currently, the changes apply on the whole page.

    I want to make the changes from WP-admin.

    How can I specify it to a specific page ?

    Edit:

    I just checked im running 3.3.1. So my version is not supported to use add_theme_support( 'custom-background' );

    instead I want to use add_custom_background.

    if ( is_front_page() )
    {
       add_custom_background();
    }

    Cant get it to work.

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    How can I specify it to a specific page ?

    You can't. Not using add_custom_background(). You need to make the changes using pure CSS.

  3. Meiioo
    Member
    Posted 1 year ago #

    Yeah if that was so easy. Its for a friend he want to change the front page from wp-admin. So the only way is to update WP and use add_theme_support( 'custom-background' ); ? Or not that either ?

  4. esmi
    Forum Moderator
    Posted 1 year ago #

    That still won't work out of the box as it's meant to change the background for the whole site. If this is a custom theme, what you might be able to do is write a callback function for the custom background so that the CSS that is generated targets the front page only.

Topic Closed

This topic has been closed to new replies.

About this Topic