My general wordpress code


/ Published in: PHP
Save to your folder(s)

Just some general Wordpress code which I use often.


Copy this code and paste it in your HTML
  1. <!--Reference the theme directory -->
  2. <?php bloginfo('template_directory'); ?>
  3.  
  4. <!--php language attributes -->
  5. <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
  6.  
  7. <!--Page template code -->
  8. <?php /* Template Name: Home */ ?>
  9.  
  10. <!--Home link -->
  11. <a href="<?php bloginfo('url'); ?>/" title="Return To Home Page &raquo; <?php bloginfo('name'); ?>" tabindex="1">
  12.  
  13. <!--Include the search form -->
  14. <?php include (TEMPLATEPATH . '/searchform.php'); ?>
  15.  
  16. <!--Search form with no search button -->
  17. <?php $search_text = "Search"; ?>
  18. <form method="get" id="searchform"
  19. action="<?php bloginfo('home'); ?>/">
  20. <input type="text" value="<?php echo $search_text; ?>"
  21. name="s" id="s"
  22. onblur="if (this.value == '')
  23. {this.value = '<?php echo $search_text; ?>';}"
  24. onfocus="if (this.value == '<?php echo $search_text; ?>')
  25. {this.value = '';}" />
  26. <input type="hidden" id="searchsubmit" />
  27. </form>
  28.  
  29. <!--RSS feeds -->
  30. <?php bloginfo('rss2_url'); ?>
  31. Also see: http://codex.wordpress.org/WordPress_Feeds
  32.  
  33. <!--List pages -->
  34. <?php wp_list_pages('title_li=&depth=0'); ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.