You can either use the Wordrpess Settings API or you can use an options framework. My team built a pretty awesome options framework that’s easy to drop into your theme. It’s called the UpThemes Framework. You can grab a copy of it at github. https://github.com/chriswallace/UpThemes-Framework
To install simply drop the admin and theme-options folder into your theme directory. Edit the theme-options files to add more options as you were attempting in your code. Lastly add this to your functions.php file.
require_once('admin/admin.php');
You will then have all the option values at your finger tips by using the following in your templates.
global $up_options;
echo $up_options->option_id;
We are still in the process of documenting out all of the option types (typography management, color picket, etc). You can see some of the features here.
Related Posts:
- Upload Multiple Files With media_handle_upload
- How to get the image EXIF date/time and use it for the WP post date/time
- ajax live search for post title
- delete uploaded file
- Replacing select2 in admin backend for all selects
- Max file size not updating
- jQuery plugin function is not a function
- Display a function using AJAX
- Enqueuing Script in functions.php vs on the page
- Allowing SVG uploads in media uploader without plug-in
- Custom image size in Media Dropdown
- Unable to get_the_content(); of a post in WordPress via AJAX
- How to load some jquery code to make validation in the theme customizer?
- Move jQuery and Migrate to footer?
- Images uploaded using media uploader are appearing upside down
- jquery won’t load in footer
- Woocommerce checkout field maxlength, make input number field only (postcode)
- Simple custom theme option not being saved
- Replace menu links with # and add name to its li
- Can I hide certain upload folders in media library [duplicate]
- WordPress upload_mimes not working for front-end uploads of 3D files
- Right way to update widget on dynamic new input field
- How to load jQuery in the footer – nothing works for me
- Not sure if enqueuing js scripts properly
- Wp_query function to search from product_title ‘OR’ product tags name
- Disable auto-resizing of uploaded images, but only for certain filename
- Allow Post Author to be 0 on Update
- Trouble with adding a wp_enqueue_script on wordpress
- WP Ajax Function Always Returning undefined
- How to search using ajax for exact phrase or words in an input field?
- how to en-queue jQuery to load before the tag
- I can’t enqueue my scripts – They literally aren’t being added to my site
- Can’t generate thumbnail images
- Change CSS for logged in users
- Always the Latest google jQuery instead of default WordPress jQuery
- Add a jQuery Function
- Option Tree integration of Custom CSS
- jQuery does not work
- using jQuery on only one page
- Can’t call Javascript function – scope?
- Changing parent element’s class or style
- Enqueuing latest version of jQuery into a child theme returns a blank screen
- Adding jQuery datepicker to Custom Post Type Metabox [closed]
- In jquery use php variable to execute an enqueued jquery file
- Turn get_posts as string into an array for use in theme admin options
- Run a jquery script on on a certain template page
- How to stop media_sideload_image from running when deleting a post?
- Add php code to wp_print_scripts?
- Possible to hook into Media Library preview File column and use a custom image?
- How can i unload effect.min.js file?
- $_Get and &_REQUEST Index Undefined on Functions.php
- Where is this JQuery coming from?
- Auto scroll to id on page load on all pages except home page. Only do this on mobile
- call_user_func_array() expects parameter 1 to be a valid callback, function
- How to load jQuery in TOP of wp_footer?
- WordPress can’t get jquery/unslider to work
- Add loggedout class on body using a function or JS
- Are innerHTML elements visible to jQuery functions?
- Include Jquery libraries in wordpress theme?
- Function that prevents users from uploading photos more photos
- Why a SlideShow (made using JQuery FlexSlider) can’t work if I load it form functions.php but work if I load it from my footer.php file? [closed]
- Creating multiple category drop down
- How to setup a popup registeration page in wordpress with function.php
- Help with IF has focus then… statment
- wp_set_object_term via js btn frontend
- Is it possible to limit number of files a non-admin user can upload via the WordPress media library?
- Populate Product Regular Price with a calculated ACF Field Value
- How to add HTML into error message
- Hide ‘add to cart’ when certain value in dropdown is selected
- What is the earliest Hook a Script can use?
- WordPress does not load jQuery
- post value to function with Ajax and jQuery
- Images with overlay
- How to use `foreach()` in ajax call
- How do i create a search option for pdf’s only
- WordPress Ajaxifying not working properly
- Load scripts into an AJAX div
- Load scripts into an AJAX div
- restrict uploaded image size and fixed image display size
- Function image_send_to_editor returns emty title tag
- True parameter but jquery register in header and not in the footer with wp_register_script
- Zip all (original) images from media gallery
- Automatic add space if user enters number(any digit)
- WordPress Jquery+scripts enqueue issue
- Moving CDN jQuery to footer does not work?
- Adding a meta box fields to child theme options page
- Adding a jQuery rotator function
- Why are some custom javascript files working but some are not
- WordPress Javascript Widget jQuery Dependency Issue
- wp_upload_bits – define (sub)folder / (sub)directory before filename?
- How to use different jquery function of idangero swiper dependant on page template?
- How do I get my nav menu to show sub pages?
- Having problems loading Jquery in functions.php
- Hiding Google Analytics code based on theme options
- Rename file after title , one small problem
- AJAX values converted to PHP Variables?
- Why don’t ‘wp_nav_menu’ CSS classes work until a menu is created?
- Animated Accordion [closed]
- How to overwrite image if it already exists – WordPress, Gravity form
- Convert Image to Webp on upload without plugin