WordPress.org

Ready to get started?Download WordPress

Forums

Options Framework
[resolved] background settings (4 posts)

  1. uili
    Member
    Posted 3 years ago #

    im trying to output the background settings, what i have is this:

    <body <?php body_class(); ?><?php $background = of_get_option('background');
       if ($background) {
       if ($background['image']) {
       echo 'style="background:url('.$background['image']. ') ';
    	foreach ($background as $i=>$param){
            echo 'background-'.$i .'= '.$param.' ' ;
            }
       }
       } else {
       echo 'style="background-color:'.$background['color'].'';
       }; ?>>

    what i get is:

    <body class="home" background-attachment="scroll" center="" background-position="top" background-repeat="no-repeat" background-image="http://127.0.0.1:8080/wilson/wp-content/uploads/2011/08/bg_body1.jpg" background-color="#000000">

    how do i fix this?!
    by the way, niiiice plugin!!

    http://wordpress.org/extend/plugins/options-framework/

  2. uili
    Member
    Posted 3 years ago #

    i did it doing

    <?php $background = of_get_option('background');
      if ($background) {
        if ($background['image']) {
        echo ' style="background:url('.$background['image'].') '.' '. $background['color'] .' '. $background['repeat'] .' '. $background['position'] .' '. $background['attachment'] .';"';
        }else{
        echo ' style="background-color:'.$background['color'].'"';
        }
      };
    ?>
  3. Devin Price
    Member
    Plugin Author

    Posted 2 years ago #

    You should output it as part of the CSS in the head. Look at how I output CSS in Portfolio Press: http://wordpress.org/extend/themes/portfolio-press

  4. Devin Price
    Member
    Plugin Author

    Posted 2 years ago #

    Or, better yet, use the native background capabilities: http://codex.wordpress.org/Function_Reference/add_custom_background

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic