Articles of theme development

Theme Check: Could not find post_class

I’ve inherited a theme from a another developer that I’ve re-styled for a client. We’re just about finished, but I thought I’d run it through the Theme-Check plug-in to see if there’s any errors or problems. Unfortunately there’s a ton. I’ve gotten rid of most of them, but I have one Required left: REQUIRED: Could […]

How do you remove plugin edit option?

I would like to remove the edit option for all plugins on a wordpress site. Is there a hook/filter for doing this? It would be preferred to do it from the theme’s functions file, rather than try to disable it within each plugin. Ideally, it could be removed for users without admin privileges, but that […]

Unhook jQuery from WooCommerce via `functions.php`?

So I am using the plugin for eCommerce and it’s registering jQuery local and conflicting with my default jQuery call from Google CDN. It took a long time but I isolated the issue to the following lines of code within woocommerce.php: $suffix = defined(‘SCRIPT_DEBUG’) && SCRIPT_DEBUG ? ” : ‘.min’; $lightbox_en = (get_option(‘woocommerce_enable_lightbox’)==’yes’) ? […]

Remove css styles from specific page

I need to remove all theme (both child and parent) css styles from a singular page using functions.php in a child theme. Here’s what I’m currently adding to the child’s functions.php // import parent and child theme css function theme_enqueue_styles() { wp_enqueue_style(‘parent-style’, get_template_directory_uri() . ‘/style.css’); wp_enqueue_style(‘child-style’, get_stylesheet_directory_uri() . ‘/style.css’, array($parent_style));} // remove the parent & […]

How to integrate plugin in WordPress theme

I have read that there are two ways for integrating a plugin on a WordPress theme. I think the first method is the best; but I do not know exactly how to do it… After copying the plugin to the plugin directory of WordPress… How do I enable it? Do you know another way to […]

Custom Template for more than 1 Tag

WordPress let me create custom tag templates, i have lots of tags, and i want to display the post tagged with some tags with a template, and the post tagged with other tags with another template. As this image shows the template hierarchy let me create the tag template easily, giving to the page the […]

Unhook action from child theme

I have decided to use a WooCommerce Storefront child theme called Galleria, when I have previously used the Storefront theme I have used the common remove_action to unhook the defaults and replaced with my own add_action. However as Galleria is a child theme of Storefront, it has its own add_action in the file class-galleria-structure.php though […]

Child Theme not loading parent CSS

I’m using the MyStile theme for a new site. I’m trying to create a child theme so I can modify the theme and not have my changes overwritten, however once I activate my child theme, the whole styling seems to go from the website all together. I’m guessing the issue here lies somewhere when it’s […]

WP_Query arguments to fetch custom post type posts which are in certain category?

I’ve played around for hours but still can’t wrap my head around the right arguments for a secondary WP_Query which shall fetch all posts of my_custom_post_type that are in the queried category. Scenario is a custom category.php template file (writing a custom theme) to render a category archive for custom post type posts. Hence, the […]

Correctly using wp_head()

I’m working on my first theme, and I found out that I had to call wp_header() before </head>. My header.php file has this: <!DOCTYPE html> <html> <head> <title><?php bloginfo(‘name’); ?> | <?php the_title(); ?></title> <meta content=’text/html;charset=utf-8′ http-equiv=’Content-Type’> <meta content=’utf-8′ http-equiv=’encoding’> <meta name=’viewport’ content=’width=device-width’> <link rel=’stylesheet’ type=’text/css’ href='<?php bloginfo(‘stylesheet_url’); ?>’> <link rel=’stylesheet’ type=’text/css’ href='<?php bloginfo(‘template_directory’); ?>/side-nav.css’> […]