Jump to content

Convert Procedural Program into Class


Tsalagi

Recommended Posts

I have some code that I think would be best off in a class or some other more efficient practice but I'm not versed in OOP so I'm looking for suggestions. The three lines of code here represent a whole block of code. In that block the functions can be repeated several times with the arguments always different. Any suggestions?

I've commented to code to explain it's relation.

register_setting( 'features', THEME.' Features', 'validate_features' );
//There may be many of these functions related to only one register_setting() function
add_settings_section('main_section', 'Main Settings', 'section_cb', __FILE__);
//There may be many of these related to only one add_settings_section() function. Note the final argument "main_section" drawing the relationship    
add_settings_field('banner_heading', 'Banner Heading:', 'banner_heading_setting', __FILE__, 'main_section');
add_settings_field('footer_text', 'Footer Text:', 'footer_text_setting', __FILE__, 'main_section');

Thanks in advance.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.