accounts@push
Forum Replies Created
-
Forum: Themes and Templates
In reply to: not displaying selected itemfor those who find this hard to read im essentially trying to get the <select> element to display the currently selected option when the page loads
Forum: Themes and Templates
In reply to: settings API dropdown list to select pagethe following code will do the same in terms of populating the list however it will not save either.
function setting_dropdown_fn() { $options = get_option('rtms_options'); echo "<select name='page-dropdown'> <option value=''>"; echo esc_attr( __( 'Select page' ) ); ?></option> <?php $pages = get_pages(); foreach ( $pages as $pagg ) { $option = '<option value="' . get_page_link( $pagg->ID ) . '">'; $option .= $pagg->post_title; $option .= '</option>'; echo $option; } echo '</select>';}
Forum: Hacks
In reply to: How to list all pages including child pages on a wordpress api settings??you’re storing thins in too many levels of arrays so when you call to them from somewhere more than often you’re not using the right code – pretty sure i reply to a similar post from you earlier today with the same answer
Forum: Plugins
In reply to: IF condition for wordpress dropdown settings apiactually going back to the code you posted it seems like you’ve got an array stored within an array – or your trying to do that – id be keeping everything into one array and then just referring to it in the ‘if’ statement like i posted before – it would be easier to work with.
Forum: Plugins
In reply to: IF condition for wordpress dropdown settings apiyou should be using a statement like
if ($settings['store_type']== "catalogue") echo 'ect...
then if your “else” statement is required then its pretty straight forward
if that doesn’t work then id consider reading up on the if and else statements and their parameters
Forum: Fixing WordPress
In reply to: settings API displaying "ARRAY" instead of actual textstill outputs as “ARRAY”
here is my code for the settings fields si there anything i can add so it shows in the options.php file as individual fields that are not serialized
<?php // add the admin settings and such add_action('admin_init', 'plugin_admin_init'); function plugin_admin_init(){ //START OF MAIN SECTION VARIABLES register_setting( 'rhythms', 'rtms_business_name'); register_setting( 'rhythms', 'rtms_email_address'); register_setting( 'rhythms', 'rtms_phone');//2nd variable to be used in the output function // define setting section add_settings_section( 'plugin_main',// section slug 'Main Settings', // section title (displays on actual page) 'main_section_deatails',//function to describe section 'plugin');// the page DO NOT CHANGE //BUSINESS NAME add_settings_field( 'business_text_string',// id of the input element - USE IN FUNCTION 'Enter the name of your business', // description of the field 'plugin_setting_string', // name of the function the displays the input field 'plugin', // the page DO NOT CHANGE 'plugin_main');// the setting section group //BUSINESS E-MAIL add_settings_field( 'email_text_string', // id of the input element - USE IN FUNCTION 'Enter your email address', // description of the field 'rtms_email_address_string', // name of the function the displays the input field 'plugin', // the page DO NOT CHANGE 'plugin_main');// the setting section group //BUSINESS PHONE NO. add_settings_field( 'phone_text_string', // id of the input element - USE IN FUNCTION 'Phone no.', // description of the field 'rtms_phone_string',// name of the function the displays the input field 'plugin',// the page DO NOT CHANGE 'plugin_main');// the setting section group //END OF MAIN SECTION VARIABLES //START OF HEADER SECTION VARIABLES //END OF HEADER SECTION VARIABLES //START OF FOOTER SECTION VARIABLES //END OF FOOTER SECTION VARIABLES }?> <?php //MAIN SECTION DESCRIPTION function main_section_deatails() { echo '<p>Settings for dynamic content throught the theme</p>'; } ?> <!--THE FOLLOWING ARE THE FUNCTIONS WHICH DICTATE THE OUTPUT OF EACH FIELD--> <?php //BUSINESS NAME - INPUT FIELD function plugin_setting_string() { $options = get_option('rtms_business_name'); echo "<input id='business_text_string' name='rtms_business_name[text_string]' size='40' type='text' value='{$options['text_string']}' />"; } ?> <?php //BUSINESS E-MAIL - INPUT FIELD function rtms_email_address_string() { $options = get_option('rtms_email_address'); echo "<input id='email_text_string' name='rtms_email_address[text_string]' size='40' type='text' value='{$options['text_string']}' />"; } ?> <?php //BUSINESS PHONE NO. - INPUT FIELD function rtms_phone_string() { $options = get_option('rtms_phone');// use variable in name=' echo "<input id='phone_text_string' name='rtms_phone[text_string]' size='40' type='text' value='{$options['text_string']}' />"; } ?>