Articles of theme options

max_input_vars: how many am I using?

I’m processing a large amount of Options in a WordPress theme. I want to ensure I keep below the default 1000 before hitting a max_input_vars error. Is there a way to test how many ‘input_vars’ I’m generating? (sorry, doubting I’m using the correct terminology here – hoping I make sense)

How to load default scripts included with WordPress correctly?

I want to know the correct way to load existing scripts in wp-includes/js/jquery/ Example I want to load jQuery UI Tabs What I have done for now function sample_exists_code() { echo ‘<script type=”text/javascript” src=”‘. CONSTANTS_JS .’/jquery.js”></script>’.”\n”; echo ‘<script type=”text/javascript” src=”‘. CONSTANTS_JS .’/jquery-ui.js”></script>’.”\n”; } add_action(‘admin_head’, ‘sample_exists_code’); and this code working fine to load the UI tabs. […]

How to override .htaccess with new rules without ftp or edit it manual

I want script will add new rules to current .htaccess and user no need to ftp or edit it manually. Example, I use timthumb for resize image on my theme and want rewrite the URL and current .htaccess will be something like this. <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^images/thumb/(.*) timthumb.php?filename=$1 RewriteRule ^index\.php$ – […]

How to add an export function to a custom Option Theme Page

I’m creating a new WordPress template and I have a question: I’ve added a custom Option Page to my new template (you can see what I’m doing Here and Here) but now I would like to add a new function. Do you know Si Contact Form? In this plugin the end user can download a […]

How do you center the main menu in CSS?

Do any of you know of a way to center the main menu on my company’s site? I have been trying all day and am frazzled! I’ve tried editing the stylesheet but nothing has fixed it. I’ve tried throwing white-space: nowrap around in the CSS but it had no effect regardless of where I put […]

How to set different settings for a mobile theme?

My desktop version of wordpress theme requires using a ‘static’ page as the start page as it has custom shortcodes etc. While this is good, when it comes to my mobile theme, sadly the ‘static’ page is being displayed and because its a different theme, the shortcodes are not being executed. Is there a way […]

WordPress theme options vs custom post types

For dynamic content across a WordPress website, is it a better practice to create new post types for updating content or using theme options? I personally find theme options a little more time consuming to code than registering a new post type in functions.php

WordPress security issue to output data from user input from theme option form

I have the following code (below) in my theme. I am using redux framework for my theme options. My codes in a part looking like this. And I am really not sure about the security issue of this chunk of codes. Please any expert help me indicating any security problem in here. Your few minutes […]

How to remove menus section from WordPress theme customizer

I tried to remove Menus from WordPress customizer (see image) I tried the following code on functions.php file and every section was removed except Menus //Theme customizer function mytheme_customize_register( $wp_customize ) { //All our sections, settings, and controls will be added here $wp_customize->remove_section( ‘title_tagline’); $wp_customize->remove_section( ‘colors’); $wp_customize->remove_section( ‘header_image’); $wp_customize->remove_section( ‘background_image’); $wp_customize->remove_section( ‘menus’); $wp_customize->remove_section( ‘static_front_page’); $wp_customize->remove_section( […]

How to deal with multiple select options using register_setting() theme options

I’m using Ian Stewart’s Sample Theme Options for a lightweight Theme Options panel. INSERTION FAILED I need to insert Multiple categories into db, where I used the following code: <select multiple=”multiple” name=”site_options[categorychoice]”> <?php $args = array( ‘orderby’ => ‘name’, ‘parent’ => 0, ‘exclude’ => 1 ); $categories = get_categories( $args ); foreach ($categories as $category) […]