I have created a wordpress theme and I made it so the background image can eas开发者_如何学Pythonily be changed. The only problem is that currently I have to make the change manually (ie FTP) and Id like to provide my client with a Template options page with an "Upload new background image" option in it.
Im pretty sure this is possible, I just dont know where to start.
Could someone point me out in the right direction?
This will do it for you. Just add the following to your theme's functions.php file:
add_action( 'after_setup_theme', 'add_custom_background' );
This only works in WordPress 3.0 as of now. Of course, you should be running the latest version anyway. It will add a custom background menu in the admin area (under 'Appearance') and will add the styles to the body tag. Also handles uploading, centering/tiling (x, y, or both) images/background colors. Very simple and great functionality.
精彩评论