|
DesigningForSandbox
#creating Template: sandbox themes. IntroductionHow to customize your sandbox installation, while keeping the sandbox intact for upgrading. Originally posted by Scott in The SDC forums DetailsIf you've had a chance to look at the designs for download on www.sndbx.org, you'll notice something possibly new in the header area of the style.css file: /* THEME NAME: My Design THEME URI: http://www.sndbx.org/ DESCRIPTION: New curtains for an old room VERSION: 0.1 AUTHOR: Scott Allan Wallick AUTHOR Uri: http://scottwallick.com/ TEMPLATE: sandbox */ The /* TEMPLATE: sandbox */ line tells WordPress to use the theme in the /sandbox/ folder. If you wanted to do the same with, let's say, the Classic theme you'd use /* TEMPLATE: classic */ This allows WordPress to use all the PHP files for a given theme, but use the CSS for your 'template'. Download some of the Sandbox designs and you'll see what I mean. Such theme 'templates' are used and installed just like any other WordPress theme. Now, in your theme 'template' folder you can also include a functions.php file that WordPress will also use. If there is a functions.php in the theme folder, it will be called first and then one in your theme 'template' folder second. Including a functions.php with your theme template allows you to do all sorts of things, like hook the wp_head and wp_footer calls, allowing you to add scripts and customized CSS to the header, and add your own back link to the footer. I'm working on my site right now, http://scottwallick.com/ and I'm using these techniques to create a fully-customized theme 'template' based on the Sandbox. Sort of a way to practice what I can do without messing with the theme files. Anyhow, here's an example functions.php, stripped down, that I am using for my site. <?php
// My Design
// Version 0.1
function header_mytheme() { // PUTS STUFF IN THE HEADER ?>
<script src="<?php echo bloginfo('stylesheet_directory') ?>/js/scottyScripts.js" type="text/javascript"></script>
<?php } // END header_mytheme
function footer_mytheme() { // PUTS STUFF IN THE FOOTER ?>
<div id="design-link"><a href="http://www.example.com/" title="My Design by Me">My Design</a></div>
<?php } // END footer_mytheme
add_action('wp_head', 'header_mytheme');
add_action('wp_head', wp_enqueue_script('jquery')); // ADDS JQUERY TO THE HEADER
add_action('wp_footer', 'footer_mytheme');
?>(Of course changing "My theme" to the name of your theme. :cool: You could also use the functions.php within a theme to build your own theme options menu specifically for your template. And all sorts of possibilities arise there: custom font choices, color scheme selections, etc. That's just scratching the surface, but that's all I have time for at the moment. For a working (and beautiful) example of everything I've described above, check out Adam's Bus Full of Hippies design/theme/template/etc. Enjoy. I'll follow this up a bit later with information on how to make a super easy SandboxOptionsMenu for your design. |
Can this be used to replace existing stuff? Say eg. I want to replace the default value(s) for footer or wp_head? Or want to replace the standard menus with the sucherfish menus.
@kjellkk:
Yes, it can. If you want to hide an element, just use display:none; in your style.css
Hi! My question is, is it possible to put a link to the home page in the menu bar?
is it possible to add a html "menu" to the div#access portion without touching the theme files? how would I go about doing
i wonder when we can create an google theme or can we create 1 now. if so plese say how.
hi, i like this theme, but i want change the header by an image, but i dont now what archive is, to make the change.
sorry for my english.
know
Thanks for creating Sandbox! Very very useful, apart from one feature, which is a submenu, or page menu... i think this code was created by WP after your last release: <code>wp_page_menu()</code> It would enable me to do menus like the NYT, where "sport" is the main and the sports are listed below: http://www.nytimes.com/pages/sports/index.html Or, is there another way of doing this in the current version? I'm struggling here, so any help would be appreciated!
I have used a plugin called Menubar. Just have paste a little code into the header to replace the existing menu function. http://www.blogsweek.com/wp-menubar-3-documentation/
How do me implement the new wordpress 3 menu systems? Or how can I used hooks to change the menu of a child theme menu within a new child theme's functions without messing with the original sandbox functions and files (I don't wanna make any change to the parent theme because I am trying of loosing everything after an upgrade of the sandbox theme. ps. the thematic theme is a good example of smart use of hooks, but I wanna keep using sandbox because of it simplicity. Thanks for any clarification on these requests.