Wordpress not registering custom options from options.php page - php

Frustrated SO regular here:
I'm creating a theme-options.php page for a child theme in Wordpress. Here's the code. The page renders correctly, including: Adding the page link to the correct admin menu, creating and displaying the options page. When I click save, however, it takes me to a 500 (internal server error page).
Using the 'adminer' plugin (phpmyadmin) I have looked at the wp_options table, and there are none of the custome settings/fields that I have specified. My best guess at the problem is that the settings aren't registering properly so when I post the form to options.php it responds with an error because it doesn't expect those form fields.
I've been wracking my brain around this code for a few days now, and am wondering if someone else can take a look at it for me? I would really appreciate a few extra eyes...
Some resources I have tried:
http://ottopress.com/2009/wordpress-settings-api-tutorial/
http://themeshaper.com/2010/06/03/sample-theme-options/
http://codex.wordpress.org/Function_Reference/add_settings_section
My settings are not saving in wordpress theme options page (his settings appear empty in db. mine don't appear at all)

Oh crud,
It dawned on me after I spent an hour figuring it out that Richard M had given you the answer.
I created a new paste of your code, cleaned up some: http://pastebin.com/enUa3xme
I fixed the issue and also added the function add_my_options() and removed the is_admin() wrapper around your admin action hooks since they will only be triggered in the admin area, so they are unnecessary.
I needed to learn this since I use a half-way-done implementation of this, so even if it isn't helpful to you, it was worth learning...

Related

OpenCart Theme 'MarketShop' slider issue

I'm using an opencart theme called MarketShop and as part of the theme it comes with a featured slider on the top of the website. It was all functioning correctly this morning, I went to edit the pictures by removing the original module and recreating it with a different banner. Now the module has been created but its not showing up on the website.
What have I done wrong?
I believe the two modules have identical information but I could be incorrect.
I've tried reupoloading all files from the theme and just skipping any that were identical in order to try and find the missing file with no luck.
Any suggestions besides doing a factory reset are much appreciated!
UPDATE:
Doesn't seem like anyone is able to determine the fault... Going to do a fresh install unless someone wants to first login themeselves and see if they can find the problem?
I managed to resolve this issue myself finallly after a LOT of playing around!
Steps I took to fix this issue were as follows..
First I uninstalled the module and reinstalled (It deleted all tests I made + the original demo items).
Then I clicked the install button again and went to edit.
I added one slideshow item and choose my banner that I'd setup earlier via the banners link in the admin panel.
I then went to LAYOUTS which is found next to the banners link or after you click save in modules at the top a hyperlink to layouts is offered.
Upon going to the layouts section and playing around here for even more time I worked out I needed to go into the Homepage file and click edit (NOT THE ONE NAME DEFAULT)!
I tried this numerous times with the DEFAULT page (Note that my store is even set so that the default theme is default which led me to believe that was the right page, which it is not.
So go into homepage and click edit.
Then add one module with the blue plus. Select the module you've just created earlier. Position it where you want it on the page (to get it to work for me I selected "Content Top" and Sort Order I set to 1 (The other two modules had sort orders of 2 and 3)
And that was that, problem solved!
Hopefully this will help anyone else with similar issues.

Joomla FrontEnd Editing breaks shortcodes

I have a joomla website in localhost.
I installed a template called Helix 2 which also has a set of Shortcodes. (i just put in something like [block]blah blah [/block] and my blah blah is highlighted in a nice looking box.)
I posted beautiful looking articles that way from BackEnd. Unfortunately, I have setup some users to be able to edit those articles from frontend. I have manually checked the Database and the shortcode is saved in the database. But when clicking edit in frontend, THAT DATABASE VERSION is not loaded in the edit field! When editing from frontend, the joomla engine DOESNOT load the database version of the article, but the version rendered from the browser or something else. The latter version doesn't have the shortcodes. So, after clicking save from Frontend the original article formatting is lost! I then have to manually reenter shortcodes in the frontend.
So the solution is, while clicking on edit button, if the article for editing is loaded from the database I can see my shortcodes in their proper places. So, is there a setting anywhere in joomla that can help me out with this?
PS: I HAVE TRIED ALL EDITORS TINYMCE, JCE, EDITOR-NONE WITH SAME RESULTS. ITS NOT THE EDITOR PROBLEM.
Which Joomla version are you using?
In Joomla 2.5 if you use a user from a different group, checkout the text filter options tab in the general settings. If you login as a super-admin and the setting for that group is "No filter", please try to change to "default blacklist" than save. Clear all joomla cache (just to be on the save site). Than change back to "No filter" option.
I have seen complaints on the joomla forum that the No Filter option while default set in some cases is not properely set. Resetting it to default blacklist and back to "No filter" might solve that problem.
What a simple solution and I had to spend so many sleepless nights surfing for a solution. In my site http://lokkatha.comthe problem was persisting for quite some time. However, with the help of the solution suggested by Wouter here, I could sort it out. the process is
Go to BACKEND ADMIN >> General configuration >> Text filters
Covert all filters to NO FILTERING The problem is solved.

How to add vertical tabs (like the product page) to a custom magento admin form

There are many tutorials to adding extra tabs to the product page but I am struggling to find information on how I can create tabs on a new form from scratch. I have looked at the following resources but the information presented doesn't seem to be very clear or my magento isn't good enough to understand it yet:
http://www.excellencemagentoblog.com/module-development-series-magento-admin-module-part3
how to create multiple tab in magento custom module?
I am trying to emulate the tab system that runs vertically down the left side of the product section but on a custom form.
Are there any references out there on how this should be done (similar to the official magento one explaining how to create an admin module)?
p.s I haven't posted code as anything I have is directly from the tutorials.
I ended up working through the excellencemagentoblog version and have successfully got tabs working. The examples given aren't exactly straight forward unless you understand the magento structure really well but the information within the article is adequate enough to work through.

WordPress - Reserved form field names?

I have installed a simple PayPal Cart plugin:
http://wordpress.org/extend/plugins/wp-ultra-simple-paypal-shopping-cart/
Installed just fine. However, when updating a quantity or anything that involves the posting of a form, WordPress returns a 404 error page.
Now, when investigating, I noticed someone mentioned that WordPress has some reserved words for form field names internally.
( http://wordpress.org/support/topic/404-pops-after-custom-form-submission-by-post )
I followed this trail and altered the name fields with Firebug on the fly and post the form.
Everything was post to the current page and it stayed on the same page (as expected) instead of the 404. So it seems that this IS indeed a WordPress issue.
Is there any way I can add exceptions to certain names in WordPress as a setting of some sort? Or if anyone knows a work-around for this plugin, I'd much appreciate it.
Many thanks for your input.
Michael.
EDIT:
Someone has also had this problem. See this thread...
http://www.ultra-prod.com/developpement-support/wp-ultra-simple-paypal-shopping-cart-group3/bugs-errors-help-forum8/404-error-thread76/
Any idea on a solution? I can't simply rename my post type. This is for a website that's already in production and has hundreds of products.
Hope someone can help.

Ticking a checkbox with PHP to put in Wordpress function.php

I recently discovered a method of changing Wordpress preferences if you do something silly that makes the wp-admin not load. I found that inserting things into the function.php file found in the theme and using the update_option command allowed me to change the settings i needed to get be working again.
This got me thinking, i have the need to install the same theme with the same settings. This is a pain as i have to define all the settings each time. Instead i am trying to make a functions.php file that will set all the settings to how i like them.
I am able to update settings that require you to type a string into a field
//this will change the siteurl setting to www.mysite.com
update_option ('siteurl','www.mysite.com');
My issue is that i need to be able to do the same thing for checkboxes, drop down menus and for radio buttons. After a long night or searching the internet for examples i had given up until i found this site.
Any help would be appreciated, i have minimal programming experience but i do understand the concepts
in theory update_option('checkboxname',true); or update_option('checkboxname','on');
http://codex.wordpress.org/Function_Reference/update_option

Categories