Ticking a checkbox with PHP to put in Wordpress function.php - 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

Related

Sliders not showing up: setREVStartSize is not defined

After I upgrade my Revolution slider plugin (5.4.5.1) for Wordpress (4.8) I start to get this error: setREVStartSize is not defined
I'm trying differents approaches to fix this but without success. Is this a specific js file to be loaded in order to fix this? I don't if my theme is loading all assets.
Thanks!
This happened to me after updating to the latest version 6.0.6.
I was able to fix it by clicking "Globals" link in the top of the Slider Revolution main dashboard page, and then selecting "Include Libraries Globally".
Another possible cause is your setting in RevSlider Global settings. Turning off 'Include RevSlider libraries globally' and then trying to include a slider on a page that is not explicitly defined by ID in the field 'Pages to include RevSlider libraries' will trigger this error. The latter field does not take page slugs, so it should be a comma separated list of IDs and/or homepage.
Same problem, spent two weeks on this and have not figured it out....
This "setREVstartsize" is a newly added API function?
Please review; http://www.madcoilbuilt.com
Im losing my mind, if someone is able to offer any insight that would be amazing! I had slider working previously and I migrated the WP installation to another host and ever since then, garbage....
This usually happens when the revslider shortcode is placed before the wp_head(); function call. Make sure that all the base scripts are loaded properly first.
In my case was a JavaScript code that I had inserted in the header without close properly the script tag. I had not updated neither wordpress, nor plugins, nor themes.
I had just installed "Insert Headers and Footers" plugin and put the code with issues there
Solved in LiteSpeed Cache
Navigate to:
Page Optimisation > Js Setting [Tab]
Under Load Inline JS (last option) select Deferred
[Save Changes]
If anyone is still struggling with this error.
For me removing the line below from my script enque file fixed it:
//remove_action('wp_head', 'wp_enqueue_scripts', 1);

Modifications to wp plugin deleted after a few days

I have a small wordpress (4.3.2) website and for the contact form I have used the free version of the Contact Bank plugin.
I have modified the one of the plugin's files (contact_bank_forms.php) located in /wp-content/plugins/contact-bank/frontend_views/ and everything looked good.
But after a few days I have noticed that every modification i made to this file was lost and realised that it went back to the original code - like I have not modified anything.
I reuploaded my modifications but it seems that every few days it goes back to the original one.
Can anyone please help me with this problem?
Wordpress has automatic updates (https://codex.wordpress.org/Configuring_Automatic_Background_Updates).
You can either disable them with config constant
define( 'AUTOMATIC_UPDATER_DISABLED', true );
Or write own plugin that will alter existing one.

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.

Magento Success Page Reverts to Default Theme

We recently added a new extension to our site that adds multiple serial codes to a product (http://www.modifymage.com/instructions/serial-codes). Everything works great except when you try to purchase one of the items. It gives you a success page that uses the default theme.
Everything appears to be setup correctly in terms of the backend. I’ve already contacted the creator but I doubt they’ll provide any support.
Also, when I view source it says its referencing the right theme but when “Inspect Element” it tells me its using the default theme.
Any ideas? I’m thinking its a template issue but the success page uses the custom theme’s CSS.
This is very unlikely to have anything to do with our extension. Our extension does not interact in any way with the front end themes.
In the Admin Panel, please first go to:
System > Configuration > General > Design
And check the settings under the Package and Themes sections. Please see this forum post for an example that presents itself exactly like the problem you are experiencing and how it was fixed:
http://www.magentocommerce.com/boards/viewthread/281457/
If that is all set up correctly, next try disabling the output of our extension and see if the problem goes away. You can do that here:
System > Configuration > Advanced > Disable Module Output
Disable Mmsmods_Serialcodes. If this doesn't fix the problem, make sure the design file template/checkout/success.phtml is located in your design theme folder.
I hope that helps. If you are still having problems, or if you have any additional questions or concerns, please notify our support department once again.

Wordpress not registering custom options from options.php page

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...

Categories