I have been focusing on a Wordpress theme project in the last couple of days and I have been stuck on tips to get a dynamic options page running correctly using OOP (I am mainly a style Developer, not really a PHP scripter).

    <?php
    $footerpage = new optionpage;
    $footerpage->title = 'Footer';
    $footerpage->titleprint = ' Footer Options';
    $footerpage->slug = 'footer';
    $footerpage->html = array(
 '1' => array(
 'type' => 'textarea',
 'class' => 'large-text',
 'name' => 'html',
 'title' => 'HTML',
 'description' => 'Type in whatever HTML you\'d like to see in the footer here:',
 ),
 '2' => array(
 'type' => 'input',
 'class' => 'large-text',
 'name' => 'background-color',
 'title' => 'Background Color',
 'description' =>  ' Choose a Background Color:'
 ),

);

    class optionpage {

 public $title;
 public $titleprint;
 public $slug;
 public $html = array();

 ......
 ......
 ......

 public function ab_settings() {

 register_setting( $this->slug, 'ab_options');
 add_settings_section('ab_section', '', array(&$this, 'ab_do_titleprint'),  'ab_' . $this->slug . '_options', 'ab_options' );

 foreach ($this->html as $key => $html) {
 add_settings_field( $key, $html['title'], array(&$this, 'ab_do_htmlprint' ), 'ab_' . $this->slug . '_options', 'ab_section');
 }

 }


 public function ab_do_htmlprint() {
 $html = $this->html[$key];
 ?>

 <p><?php echo $html['description'] ?></p>
 <<?php echo $html['type'] ?> 
 id="<?php echo $html['id'] ?>"
 class="<?php echo $html['class'] ?>"
 name="<?php echo $html['name'] ?>">
 <?php get_option ($html['name'])?>
 </<?php echo $html['type'] ?>> 
 <?php
 }

 ......
 ......
 ?>

Within this code example, I am looking to get the function ab_do_htmlprint to identify the foreach expressions where it has been known as, since the function will probably be known as as numerous occasions when needed within the foreach loop.

I have attempted a number of things, like appending a flexible towards the function title, but that will require multiple functions of the identical code, simply with another title. I additionally attempted passing various variables by reference and the like, nonetheless they were not working either, and that i might not have been doing that properly, if they are even needed.

Anyway to do this effectively? Hopefully situations are obvious enough.

Basically understand properly you possess an variety of values that you would like to exhibit inside a group around the admin screen as options.

Maybe the least example is exactly what i published here: http://swiftthemes.com/forums/showthread.php?383-SWIFT-on-a-WordPRess-MU-install/page2

p.s. publish WordPress questions about http://wordpress.stackexchange.com : more WordPress Experts!