How to store options in an array

I am creating a custom table to display selected options for a page called “Testimonials”. The user will enter their options on a “manage testimonial settings” page, and then those options will display in a WordPress-style table on a separate page.

All the settings are stored in an options array called “testimonials_settings” which is shown below:

Read More
if(isset($_POST['testimonials_update_options'])) {
   $options = get_option('testimonials_settings'); 
   $options['testimonials_active'] = $_POST['testimonials_active'];
   $options['testimonials_name'] = $_POST['testimonials_name'];
   $options['testimonials_website_name'] = $_POST['testimonials_website_name'];
   $options['testimonials_website_url'] = $_POST['testimonials_website_url'];
   $options['testimonials_quote'] = $_POST['testimonials_quote'];
update_option('testimonials_settings', $options);
    }
}

In the image below, you can see that I can successfully show these options on a menu page called “Testimonials”.

enter image description here
Now I’m running into a roadblock because I need to take these settings and display them dynamically in a table for the user to edit/delete/update. So here are my questions:

  1. Can I create code that will display these options dynamically in my current table, considering that I’ve created the table from scratch?

  2. If so, what would be the process of displaying these options in my table (i.e. could an example be provided to do this?)

Related posts

Leave a Reply