Articles of theme development

Why is the Links Manager visible?

The admin panel of my WordPress (4.7.2) installation on my hosting (godaddy) has “Links” section enabled. I set it up a few seconds ago with storefront theme. Then removed storefront and activated starter theme _S (underscores). Even though I did not use following code, the links section is visible. Why is that? add_filter( ‘pre_option_link_manager_enabled’, ‘__return_true’ […]

Use different javascript files for each page on website

I’m currently trying to create my first ever theme on wordpress. I’m hosting it locally until I can get it all working and then I will use the theme on a website. Everything was going great until I got to the javascript. Each page on the theme has a character counter box which counts up […]

What is the correct way to do a mobile theme for WordPress?

I’m building a custom theme, along with a custom mobile theme counterpart. They don’t share resources, CSS, etc. (cause I like to keep them clean, and separate). My question is: how does everyone (preferably other professionals) go about doing this? I’m using the Mobile Detect script to redirect users to the ‘mobile’ sub-folder when they […]

Remove the word 'Categories' from wp_list_categories

I’ve got the following code: wp_list_categories(); It outputs all my categories, however, it makes them the child of a list element, called CATEGORIES. So, I get an unordered list, like so: CATEGORIES * FASHION * DAILY FASHION CANDY * TRENDS * BEAUTY * ACCESSORIES * CELEBRITIES * LIFESTYLE However, I only need: * FASHION * […]

wp_get_attachment_image_src() width and height boolean

I have the following code in my theme: <?php $size = ‘large’; $postimage = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), $size ); $url = $postimage[0]; $h = $postimage[2] ?> <div style=”background-image: url(<?php echo $url; ?>); height: <?php echo $h; ?>;”></div> Here’s an example var_dump output for $postimage: array(3) { [0]=> string(99) “{base url here}/uploads/2013/10/h3greendeck.jpg?fit=660%2C660” [1]=> bool(false) [2]=> […]

Force index.php have_posts() loop to exit if no sticky posts found

I’m currently using the code below to list sticky posts on my index.php. However, when no sticky posts are present, its loading the latest posts (up to the number specified in “settings > reading > blog posts show at most _ posts”. How can I alter the script so that if there are no sticky […]

Creating multiple hooks for theme

Iam working on a theme in the moment and got to the point where I also want to add some custom hooks to some locations, to enable some more flexibility. I want to add multiple hooks to the theme. I have different sections (header, content, sidebar, footer etc) and on all those locations I want […]

Integrating Html5Boilerplate's Builder into a WP Theme

So Im planning to use Html5Boilerplate as a base to build a new WP Theme on. The Boilerplate comes with the Builder, a handy Tool for minifiying, concatenating and compressing ones Website for obvious reasons: speed/performance-gain, easier mobile access and so on. I would very much like to use this feature with my theme. Problem: […]

Hide a menu-item and its submenus and display a 'Log in' link if the user is logged out

I need, somehow, to enable that when you logout, that ‘My Account’ item is getting hidden from the navbar, and instead it displays a ‘Log in’ link. The item ‘My Account’ also have submenus with the items ‘Log out’ and ‘Track your order’. This should be hidden as well (I guess it gets hidden when […]

Check if password protected post is visible

Is there anyway of checking if a password protected post is visible / not visible? I want some thing that says this; If the post is password protected (that parts fine) and the correct password hasn’t been entered, then show ‘XXX’, else show ‘ZZZ’.