Advanced Themes Functions and Other Code
-
Howdy! I’ve been downloading and breaking down the code in themes to find out how they are put together so I can learn how to build my own. Some of the themes are very basic and some are very Advanced(it seems). The question I have is about the advanced themes. I understand that you can create your own options page in the admin area, which is a nice feature. However, it seems to me that some of the themes just throw some PHP code into the functions file, to make it look advanced and it really doesn’t go anywhere except in a big circle that may actually cause more calls to be made than necessary. For instance, in one them they define the template name the paths to all of the template folders like so.
// Theme define('THEMENAME','Theme Name'); define('THEMENAMESHORT','Short Theme Name'); // names and stuff define('SITENAME',get_bloginfo('name')); define('RSSURL',get_bloginfo('rss2_url')); define('ACTIVATED', $_GET['activated']); // Define directory constants define('INC', TEMPLATEPATH . '/inc'); define('CSS', TEMPLATEPATH . '/css'); define('JS', TEMPLATEPATH . '/js'); define('SNIPS', TEMPLATEPATH . '/snips'); // Define folder constants define('ROOT', get_bloginfo('template_url')); define('CSS_FOLDER', ROOT . '/css'); define('JS_FOLDER', ROOT . '/js'); define('IMAGE_FOLDER', ROOT . '/images');
And this goes in the header:
<link rel="stylesheet" href="<?php echo CSS_FOLDER.'/reset.css';?>" type="text/css" media="screen" /> <link rel="stylesheet" href="<?php echo CSS_FOLDER.'/wp.css';?>" type="text/css" media="screen" /> <link rel="stylesheet" href="<?php echo ROOT.'/style.css';?>" type="text/css" media="screen" />
When all is needed is to use what WordPress has built in.
Like this:<title><?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?></title> <link rel="shortcut icon" type="image/x-icon" href="<?php echo get_option('home'); ?>/favicon.ico" /> <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" /> <!--[if IE 7]><link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/ie.css" type="text/css" media="screen" /><![endif]--> <script src="<?php bloginfo('template_url'); ?>/js/animate.js" type="text/javascript"></script>
I’m mean really. Isn’t that just a long way around to the same path?
Thanks for your thoughts.
- The topic ‘Advanced Themes Functions and Other Code’ is closed to new replies.