WordPress theme development tricks

0.6K views
no comments
20 Sep 2015 12:45 pm

WordPress theme development tricks don’t forget them.

 

CALL WP_HEAD FUNCTION IN YOUR THEME’S HEADER.PHP FILE

Call wp_head() function in your theme header.php file because many plugins even theme developer add javascript, css files through functions.php file with many some functions like wp_eneque_script()  wp_eneque_style(), and many seo plugins like WordPress SEO, All in one SEO can add meta tags, meta description titles and OG:Tittle, OG:Thumb, OG:Description for display content on social networks.

 

CALL WP_FOOTER FUNCTION IN YOUR THEME’S FOOTER.PHP FILE

Call function wp_footer in your theme footer.php, this is same thing already describe in wp_head function.

 

PREVENT USER FROM DIRECT OPEN OF YOUR WORDPRESS THEME FILES (sdtuts.com/wp-content/themes/mywp_theme)

Its danger can direct access like sdtuts.com/wp-content/themes/mywp_theme/header.php and header will be shown error with your hosting absolute path, like call to undefined function wp_head on public_html/wp-content/themes/mywp_theme/header.php line no: 12, blog_info, because we’ve called many function in header while in theme development and absolute path very danger. Here is two methods to prevent this issue. one is disable PHP ERROR REPORTING or if you are running site in development mood add below code

if(!function_exists('wp_head')){
	die('Forbidden!');
}

DO NOT LEAVE WHITE SPACE IN THEME FILES

Always check white space before php start tag <?php  and after php tag closed ?> from your theme hierarchy template files, If white space found page will be thrown warning like  Warning: cannot modify header information – headers already sent by (output started at /public_html/wp-content/themes/mywp_theme/footer.php:15) in /public_html/wp-includes/pluggable.php on line 690

NOTE:Your Email Address will be not shown and please do not add spamming comments because here is REL="NOFOLLOW" on your links and comments also moderated shown.
<code>Put html css or any language code under this tag</code>