Options don’t save, validation callback not executed
<form action=”” method=”post”> should be <form action=”options.php” method=”post”> Must have overcompensated for something there.
<form action=”” method=”post”> should be <form action=”options.php” method=”post”> Must have overcompensated for something there.
I think you’re just looking for a basic php include: include ‘/some.php’; Just make sure the path is correct. I’ve used this before no problem, php will interpret your included file as if it were part of the file including it. … after reading your question again you may be asking for something even simpler, … Read more
If you want to do it dynamically on the page you need javascript. This tutorial explains how to add a items to a <select> box. You would have a textbox, the user would type that information in, when they press a button, that would trigger a JavaScript function like the one in the tutorial. Does … Read more
You’re using same callback function for both setting fields. Use different ones with it’s own inputs. Here’s updated code: <?php /* Plugin Name: Settings API Demo Description: Learning Setting Field and Settings Section Author: Teno */ add_action(‘admin_init’, ‘settingsapi_init’); function settingsapi_init(){ register_setting( ‘settingsapi_optiongroupname’, ‘settingsapi_optionname’); add_settings_section(‘plugin_main’, ‘Section 1’, ‘settingsapi_sectiondescription’, ‘settingsapi_pageslug’); add_settings_field(‘plugin_text_string_a’, ‘Option A’, ‘settingsapi_setting_string_a’, ‘settingsapi_pageslug’, ‘plugin_main’); add_settings_field(‘plugin_text_string_b’, … Read more
You have to create a new array for the new item and pass the parent parameter as the id of this already created item. In your case, the args array should be like this: $args = array( ‘id’ => ‘my-item’, ‘title’ => ‘My Item’, ‘href’ => ‘#’, ‘parent’ => ‘theme_page’, ‘meta’ => array( ‘title’ => … Read more
Create an Option Page and name it something like “Adress”. In Google you will find a lot about Option Pages. For this small Settings, i would not recommend to use a option-framework. Some Links: Nettuts or 12 how to’s.
This kind of setup skeleton works for me to process the custom options page input : <?php /* Plugin Name: Settings Skeleton */ if(!class_exists(‘MySettings’)){ function call_my_settings() { return new MySettings(); } if (is_admin()){ add_action( ‘init’, ‘call_my_settings’ ); } class MySettings{ public function __construct(){ add_action(‘admin_menu’, array(&$this, ‘add_menu’)); add_action(‘admin_init’, array(&$this,’settings’) ); } public function add_menu(){ add_options_page(__(‘My Plugin … Read more
Are you talking about Custom Fields? I would recommend reading this part of the codex: http://codex.wordpress.org/Custom_Fields#Usage
Create the ads as custom post types and register one or more custom taxonomies for these post types. You can set up the other meta data as post meta (also known as custom fields). The options table is probably not the best place for these data; because you have to reinvent the wheel.
You should include your options-register-defaults.php to make the callback available. function chr_settings() { require_once ‘options-register-defaults.php’; // add path to file /* register_setting( $option_group, $option_name, $sanitize_callback )- Associates an option group passed to settings_fields with database entry */ register_setting( ‘mycustom_options’, ‘mycustom_options’, ‘ch_options_validate’ ); add_settings_section(‘ch_settings_defaults_style’, ‘Style Options’, ‘ch_settings_defaults_style_section_text’, ‘mycustom’); }