Articles of theme development

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)

Featured Image not showing in admin

Currently im making new theme and had the idea of adding featured image in the admin side of wordpress, unfortunately its not working this is what i have tried I have added this code in functions.php add_theme_support( ‘post-thumbnails’); i also tried to change it add_theme_support( ‘post-thumbnails’, array( ‘post’ ) ); // Add it for posts […]

How to reorganize the items returned by wp_list_comments()?

I’m new to WordPress theme development and learning by building a new theme of my own. I want to reorganize the items returned by wp_list_comments(). I created comments.php in my theme folder and it currently looks like this- <div id=”comments”> <ol class=”commentlist”> <?php $comments = get_comments(array( ‘post_id’ => XXX, ‘status’ => ‘approve’displayed )); wp_list_comments(array( ‘per_page’ […]

What is the best way to organize template parts?

I am trying to bring some order in to theme files and would like to separate templates parts. I see that underscore ( _s ) has done something similar but they moved only content templates inside , I have several templates for header , footer, content, portfolio, do you think that order like this would […]

Does a premium / for sale theme need to go through the WordPress approval process?

I am about to finish 2 themes for sale. Do I need to put these through the approval process?

WordPress post arrangement using post_class

I want to create post layout in the following way: +——————–+ | 1 Full Width Post | +———-+———+ | 2 | 3 | +——————–+ | 4 Full Width Post | +———-+———+ | 5 | 6 | +———-+———+ So basically I want to use the post_class(). Say for full width it will be “full-width” class and […]

Change the template of multiple multisite pages at the same time

I have a multisite network with hundreds of individual location-based sites that use the same theme and display the same type of content. Occasionally I will need to create or change the template of a page for one site and do so by logging in and out of each subsite to repeat this change across […]

How to To Filter wp_enqueue_script() Scripts on Some Pages

I am using following code to add some scripts in WP pages like function add_js() { wp_deregister_script(‘jquery’); wp_register_script(‘jquery’, “http” . ($_SERVER[‘SERVER_PORT’] == 443 ? “s” : “”) . “://”, false, null); wp_enqueue_script(‘jquery’); wp_enqueue_script( ‘bootstrap-js’, get_template_directory_uri() .’/js/bootstrap.min.js’, array(‘jquery’),”,true ); wp_enqueue_script( ‘colorbox-js’, get_template_directory_uri() .’/js/jquery.colorbox-min.js’, array(‘jquery’),”,true ); wp_enqueue_script( ‘img-loader’, get_template_directory_uri() .’/js/img-load.js’, array(‘jquery’),”,true ); wp_enqueue_script( ‘box-tanzim’, get_template_directory_uri() .’/js/tanzim.js’, array(‘jquery’),”,true […]

way to include own functions independent of theme

I know how to include my own functions by writing them into the theme’s functions.php and enqueuing them, or by including a php file containing all that in functions.php. But that is always bound to the used theme. If I switch to another theme, I always have to copy that code to the new theme’s […]

My javascript jquery won't work?

I am trying to make a mobile navigation for my site. However the jquery code won’t work. You can see what I am trying to do here: jsfiddle. I have the html in my header.php after body tag, css in my style.css For javascript I enqueued it in my functions php: wp_enqueue_script( ‘test’, get_template_directory_uri() . […]