awhite2
Forum Replies Created
-
Forum: Hacks
In reply to: When I call information saved in an options page only one letter shows up.I’ve somehow fixed it. I think trying to put the info into an array was messing things up and making it too complicated. Thanks.
Forum: Hacks
In reply to: When I call information saved in an options page only one letter shows up.Yes, that’s where I got the code template from. Or I should say for the incorporating part.
Forum: Hacks
In reply to: When I call information saved in an options page only one letter shows up.I’m not sure. This is all of the code I have written for it. I’m testing wether or not it is storing the values and it is.
Forum: Hacks
In reply to: When I call information saved in an options page only one letter shows up.Well, I am. This is the code for my theme functions page on my child theme. The second piece of code I put in my original post is in my header template.
Forum: Hacks
In reply to: When I call information saved in an options page only one letter shows up.Sorry, I know this is a lot but I didn’t want to leave anything out.
<?php class wctest{ public function __construct(){ if(is_admin()){ add_action('admin_menu', array($this, 'add_settings_page')); add_action('admin_init', array($this, 'page_init')); } } public function add_settings_page(){ // This page will be under "Settings" add_options_page('Settings Admin', 'Station Settings', 'manage_options', 'station-setting-admin', array($this, 'create_station_page')); } public function create_station_page(){ ?> <div class="wrap"> <?php screen_icon(); ?> <h2>Station Settings</h2> <form method="post" action="options.php"> <?php // This prints out all hidden setting fields settings_fields('test_option_group'); do_settings_sections('station-setting-admin'); ?> <?php submit_button(); ?> </form> </div> <?php } public function page_init(){ register_setting('test_option_group', 'array_key', array($this, 'check_ID')); register_setting('test_option_group', 'array_key', array($this, 'check_url')); add_settings_section( 'setting_section_id', 'Station Settings', array($this, 'print_section_info'), 'station-setting-admin' ); add_settings_field( 'station_name', 'Station Name', array($this, 'name_field'), 'station-setting-admin', 'setting_section_id' ); add_settings_field( 'station_url', 'Station URL', array($this, 'url_field'), 'station-setting-admin', 'setting_section_id' ); } public function check_ID($input){ if(!empty($input['station_name'])){ $mid = $input['station_name']; }else{ $mid = ''; } return $mid; } public function check_url($input){ if(!empty($input['station_url'])){ $mid = $input['station_url']; }else{ $mid = ''; } return $mid; } public function print_section_info(){ print 'Enter your settings below:'; print get_option('station_name'); } public function name_field(){ ?><input type="text" id="stationname" name="array_key[station_name]" value="<?php get_option('station_name');?>" /><?php } public function url_field(){ ?><input type="text" id="stationurl" name="array_key[station_url]" value="<?php get_option('station_url');?>" /><?php } } $wctest = new wctest();Forum: Hacks
In reply to: When I call information saved in an options page only one letter shows up.I’m calling the array that the field is in. I guess that part didn’t copy.
Forum: Hacks
In reply to: When I call information saved in an options page only one letter shows up.Yes, and that works fine.
Forum: Hacks
In reply to: When I call information saved in an options page only one letter shows up.Yes.
Forum: Fixing WordPress
In reply to: Moving site to new server: error establishing database connection.Thanks for your confidence but my information was correct. The problem was in the way that the database was backed up, and some of the tables did not have data.
For those who have this problem, try to back up your database again while checking on mySQL “structure and data” again. this resolved the issue for me.
Forum: Fixing WordPress
In reply to: Moving site to new server: error establishing database connection.I used this code: <?php
$link = mysql_connect(‘local’, ‘name’, ‘password’);
if (!$link) {
die(‘Could not connect: ‘ . mysql_error());
}
echo ‘Connected successfully’;
mysql_close($link);
?>
to test that and it connected successfully.
Forum: Fixing WordPress
In reply to: Moving site to new server: error establishing database connection.After repairing the database I am still getting this error.
Forum: Fixing WordPress
In reply to: Moving site to new server: error establishing database connection.Yes, also because this got a message from the moderator on another forum, this is not my real password and username. This database does not exist.
But, yes I followed that. I’ve gotten it to work without uploading my database, due to a mispelling in subdirectory folders, but with a database it still doesn’t work.
I’m now trying to repair the database.