Below you will find snippets to help you through developing a wordpress template, hope it helps :)
####get the home URL
<?php echo get_option('home'); ?>
####display the blog description
<?php bloginfo('description'); ?>
| <?php | |
| /* | |
| Plugin Name: Youtube Shorty | |
| Description: Embed YouTube videos using the shortcode [yt] | |
| */ | |
| function youtube_short($atts) | |
| { | |
| if (!isset($atts['width'])) {$atts['width']="100%";} |
| <?php | |
| /* Facebook */ | |
| add_filter('the_content', 'likebutton', 99); // Display underneath the_content | |
| function likebutton () | |
| { | |
| echo '<iframe src="http://www.facebook.com/plugins/like.php?href='.urlencode(get_permalink($post->ID)).'&layout=standard&show_faces=false&width=450&action=like&colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe>'; | |
| } ?> |
| <? | |
| /* | |
| Plugin Name: Sitemap Generator | |
| Description: Generates a XML sitemap For Google Webmaster tools | |
| */ | |
| // On publish of post, update sitemap | |
| add_action("publish_post", "sitemap_gen"); | |
| // Update of page |
| <?php | |
| class get_contents { | |
| public function url($url) | |
| { | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_HEADER, 0); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| <?php | |
| /* | |
| Plugin Name: Mobile Theme Switch | |
| Description: Switches WordPress theme based on user agent | |
| */ | |
| session_start(); | |
| if($_GET['mobile'] == "off"){ | |
| $_SESSION[$mobilethemeswitch] = "off"; |
| <?php | |
| /* | |
| Plugin Name: Raw Posts | |
| Description: Removes WordPress auto formatting using the short code [raw] [/raw] | |
| */ | |
| remove_filter('the_content', 'wpautop'); | |
| remove_filter('the_content', 'wptexturize'); | |
| add_filter('the_content', 'rawposts', 99); |
| <!DOCTYPE html> | |
| <html lang="en" dir="ltr"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <!--[if lt IE 9]> | |
| <script src="http://html5shim.googlecode.com/svn/trunk/html5-els.js"></script> | |
| <![endif]--> | |
| <style> | |
| body { | |
| font-size: 14px; |
| jQuery(document).ready(function() { | |
| function h() { | |
| var e = document.createElement("link"); | |
| e.setAttribute("type", "text/css"); | |
| e.setAttribute("rel", "stylesheet"); | |
| e.setAttribute("href", l); | |
| e.setAttribute("class", c); | |
| document.body.appendChild(e) | |
| } | |
| function p() { |
| <?php | |
| class mSQL{ | |
| var $host; | |
| var $username; | |
| var $password; | |
| var $database; | |
| public $dub; |