Articles of theme development

How to add a checkbox element to attachments editor with example

The code below adds a custom input field to the attachments editor. How can I convert the text input to a checkbox and get/set the value of the checkbox on load and save? Note: “input” => “checkbox” does not work 🙁 function image_attachment_fields_to_edit($form_fields, $post) { $form_fields[“imageLinksTo”] = array( “label” => __(“Image Links To”), “input” => […]

Why doesn't default WordPress page view use force_balance_tags?

I noticed that the default WP theme uses force_balance_tags for listing posts’ excerpts. This way, it doesn’t cause major html breakage whenever someone writes a post like <div><b>This is an excerpt. <!–more–> and this is more text… </b></div> It will close tags instead of bolding everything, and breaking div. Why doesn’t the normal wordpress page […]

What are the ADVANTAGES of ORIGINAL wordpress template structure?

Precondition: coming from a Custom PHP applications(using symfony, zend and so on) world, for me it feels unnatural to have template separated in a way that is done in original wordpress theme. e.g top part of a page is in header, center in a “index, page…” and bottom part in a footer. example of current […]

How can I get page slug

How can I get the slug of a page or post?

Best practices for monitoring the need for future updates on a theme that I developed?

I recently developed a theme which has been accepted into the WordPress repository. I want to keep this updated for my users. What is the recommended way to monitor the theme’s need for updates? My guess is that it should be checked for deprecated functions and using debug etc plugins perhaps every time there is […]

WooCommerce shop page to use my custom template

Before asking the question I want to tell you that I have already asked the question in https://stackoverflow.com/questions/15025213/wordpress-woocommerce-template-file-overiding I am using the WooCommerce plugin to develop a website. Everything is fine with WooCommerce. As per my requirement, I have configured my home page as a shop base page from the WooCommerce dashboard to make my […]

Auto get_header and get_footer on every template?

Is there a way to automatically run get_header() at the beginning of template and get_footer() at the end of it? Currently my code is too repetitive with those calls. I’ve been looking for a way to do this, but I can’t find it in Google.

When to use _e and __ for the translation?

What is difference between _e() and __() functions for the translation? In what cases e() and __ ()should be used?

Add Caret to Menu Items with Sub-Menus in WordPress Theme

I’m working on a custom theme using wp_nav_menu(). What I want to do is add a caret to menu items that have sub-menus. For example, If my menu looks like this: Menu Item 1 Menu Item 2 Menu Item 2a Menu Item 2b Menu Item 3 I want to be able to format it like […]

Custom Image section in Customizer

So I have this Custom Section in the Customizer that controls the Feature Products on the Home Page. There all registered and so on but the problem I’m stuck on is when the client uploads one of the feature image I don’t know how to make it update. functions.php code I’m working with: // Customiser […]