WordPress.org

Ready to get started?Download WordPress

Forums

Where to find code for 2011 bg options (2 posts)

  1. wolf99
    Member
    Posted 2 years ago #

    Hi folks
    I am messing around with a 2011 child theme and wondering how hard it would be to add an option to the admin>appearance>background panel...

    I would like to be able to give users the option of changing the vertical alignment of the background image instead of just the horizontal

    I know this can be very easily done by the child theme's style.css, but how to provide it as an option?

    I did find sites with tutorials on adding options for the theme Options panel, but not the background panel.... As I type that I realise that the background panel may not actually be part of the theme... It wasnt there in older versions of WP if I remember correctly, but I havent found any 2011 theme files relate to it so far (not finished looking though).

    Any help appreciated, thanks! :)
    Happy Christmas.

  2. wolf99
    Member
    Posted 2 years ago #

    OK on the back of my thought at the end of the last post I found wp-admin/custom-background.php and its take_action() function.

    A) is it possible to override this in a child theme like manner, or will I need to actually alter this file?
    B) if I need to alter the file, can I safely add a new if(){...} to the function just before $this->updated = true; and add the code for displaying it something like:

    <tr valign="top">
    <th scope="row"><?php _e( 'Vertical Position' ); ?></th>
    <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Vertical Position' ); ?></span></legend>
    <label>
    <input name="background-vertical-position" type="radio" value="top"<?php checked('top', get_theme_mod('background_vertical_position', 'left')); ?> />
    <?php _e('Top') ?>
    </label>
    <label>
    <input name="background-vertical-position" type="radio" value="middle"<?php checked('middle', get_theme_mod('background_vertical_position', 'left')); ?> />
    <?php _e('Middle') ?>
    </label>
    <label>
    <input name="background-vertical-position" type="radio" value="bottom"<?php checked('bottom', get_theme_mod('background_vertical_position', 'left')); ?> />
    <?php _e('Bottom') ?>
    </label>
    </fieldset></td>
    </tr>

    Prob not that easy, am pretty n00b at PHP though, only learning as I go, just enough to get by...
    Thanks for any help

Topic Closed

This topic has been closed to new replies.

About this Topic