Forum Replies Created
-
AuthorPosts
-
egnsh98MemberI still haven’t been able to figure this out. I’ve done some research but nothing seems to be relevant to Piklist. Has anyone else experienced this?
egnsh98MemberYou are right, it was much easier. This is resolved now.
egnsh98MemberOkay thanks, I hope to be updating the site soon anyways..
egnsh98MemberOkay thanks. Would I be better off going my initial route when I first opened this topic, or can I still use the piklist functions to help breakdown the array? I have trouble wrapping my head around some of this stuff.
egnsh98MemberSteve,
I’ve managed to get the values outputting on the screen for test purposes as I had wanted. Only issue is the values are being output in the add_more template file, not in the main class file that I am working with. How should I access those variables, will I need to create getters and setters to move that data between files or is there a better way?
The structure for this data in my main class file looks something like this:
// Get the schedule group information $schedule_group = $options['sched_group']; // 1. Display the data using the file schedule_template.php. // 2. Assign your $sched_cat parameter (from above) to 'data'. // 3. Loop through 'data'. piklist('schedule_template', array('data' => $schedule_group, 'loop' => 'data')); $sched_category_id = $data['sched_cat']; $sched_timestamp = $data['sched_time']; $sched_format = $data['sched_format']; var_dump ( $sched_category_id . $sched_timestamp . $sched_format );Regards.
egnsh98MemberShould have checked that out first. Thanks a lot for the reference, I’ll have a look over it now 🙂
egnsh98MemberThanks Steve!
We are definitely moving in the right direction. Currently I need to click “Save Settings” twice for the fields to be registered in the database. In addition the WordPress “Settings saved.” notification appears twice, not sure if this is related though, just an observation.
Regards.
egnsh98MemberRemoving the scope parameter did the trick! I guess I was just a little confused because from the Documentation I read this:
http://piklist.com/user-guide/tutorials/display-taxonomies-as-a-dropdown-or-radio-buttons/
Notice we set the scope here. In most cases Piklist will automatically determine the scope. But when using taxonomies you will need to set ‘scope’ => ‘taxonomy’
I just found that a little misleading. Thanks for clearing this up though 🙂
Cheers!
egnsh98MemberOkay I am a little closer to my ideal solution. After further digging I am using Field Groups and add_more fields to have the Piklist fields appear in a row layout, but I am still stuck on having each Piklist field row appear as a table row in an HTML table. In addition all the fields I add to my page, regardless of where the are in the code, are appearing at the very end of all my other content. Also is there a way to remove the fields from the default structure? (I want the field group to be full width with no description to the left).
egnsh98MemberAs requested, I have emailed a copy of the code.
Thanks!
egnsh98MemberAfter investigating further, even manually typing a string into the value parameter of the hidden field registers nothing in the database. This is leaning me towards thinking the syntax of my hidden field is wrong? The hidden field does not exist on a post, user, or taxonomy, but on a custom admin page that I have created and registered with WordPress.
egnsh98MemberSure I can do that, but I have one question first. If I am understanding the hidden field correctly, any value passed to the ‘value’ parameter of the field will be registered in the options database table?
egnsh98MemberI’m not sure how changing my functions to static would help. The getter and setter functions I have in my other class reference
$thisso changing to static would place that out of context. If I understand correctly, when I save the settings the value of the hidden field would be$userand it would get stored into the database? Because that is what I am trying to achieve.Within /parts/settings/twitter.php if I echo the value of
$userbefore the hidden field it prints out what I would expect, but when I check the options in the database the value of the hidden field is 0, and not the value of$user
egnsh98MemberHere it is. And as I said,
$userhas a value if I echo it, but does not get passed into the value parameter of the hidden field.<?php /* Title: Twitter Setting: twitter_settings Tab: Twitter Settings Order: 200 */ // Consumer Key piklist('field', array( 'type' => 'text' ,'field' => 'consumer_key' ,'label' => __('Consumer Key') ,'value' => __('Consumer Key') ,'help' => __('Enter the Consumer Key found in your Twitter Apps settings') ,'capability' => 'manage_options' ,'position' => 'wrap' ,'serialize' => 'false' ,'attributes' => array( 'title' => 'Twitter API Application Consumer Key' ,'alt' => 'Twitter API Application Consumer Key' ,'tabindex' => '1' ,'onfocus' => "if(this.value == 'Consumer Key') { this.value = ''; }" ,'columns' => '12' ) )); // Consumer Secret piklist('field', array( 'type' => 'text' ,'field' => 'consumer_secret' ,'label' => __('Consumer Secret') ,'value' => __('Consumer Secret') ,'help' => __('Enter the Consumer Secret found in your Twitter Apps settings') ,'capability' => 'manage_options' ,'position' => 'wrap' ,'serialize' => 'false' ,'attributes' => array( 'title' => 'Twitter API Application Consumer Secret' ,'alt' => 'Twitter API Application Consumer Secret' ,'tabindex' => '2' ,'onfocus' => "if(this.value == 'Consumer Secret') { this.value = ''; }" ,'columns' => '12' ) )); // Access Token piklist('field', array( 'type' => 'text' ,'field' => 'oauth_token' ,'label' => __('Access Token') ,'value' => __('Access Token') ,'help' => __('Enter the Access Token found in your Twitter Apps settings') ,'capability' => 'manage_options' ,'position' => 'wrap' ,'serialize' => 'false' ,'attributes' => array( 'title' => 'Twitter API Application Access Token' ,'alt' => 'Twitter API Application Access Token' ,'tabindex' => '1' ,'onfocus' => "if(this.value == 'Access Token') { this.value = ''; }" ,'columns' => '12' ) )); // Access Token Secret piklist('field', array( 'type' => 'text' ,'field' => 'oauth_token_secret' ,'label' => __('Access Token Secret') ,'value' => __('Access Token Secret') ,'help' => __('Enter the Access Token Secret found in your Twitter Apps settings') ,'capability' => 'manage_options' ,'position' => 'wrap' ,'serialize' => 'false' ,'attributes' => array( 'title' => 'Twitter API Application Access Token Secret' ,'alt' => 'Twitter API Application Access Token Secret' ,'tabindex' => '1' ,'onfocus' => "if(this.value == 'Access Token Secret') { this.value = ''; }" ,'columns' => '12' ) )); // Get the user's profile information $instance = Main::get_instance(); $user = $instance->get_user(); // Twitter Name piklist('field', array( 'type' => 'hidden' ,'field' => 'twitter_name' ,'value' => $user )); ?>
egnsh98MemberI’ve got the getter methods working now, and when I print them out in /parts/settings/twitter.php, they display, but don’t seem to be getting picked up by the hidden field. Should I be setting the $user variable on a different parameter?
-
AuthorPosts