How To Widgetize WordPress Themes
Using the following snippet, you will be able to widgetize WordPress themes.
1 2 3 4 |
<?php if ( function_exists('register_sidebar') ) register_sidebar(); ?> |
Snippet Source/Credit: Themelab
How To Have A Loop In WordPress Category
With the help of following snippet below, you will be able to have a loop in category in WordPress.
1 2 3 4 5 |
<?php $my_query = new WP_Query('category_name=events&posts_per_page=4'); ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <?php the_title(); ?> <?php the_excerpt(); ?> <?php endwhile; ?> |
How To Have A Monthly Archives Of WordPress Articles
The following snippet will let you have a monthly archives collection of WordPress articles.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
<?php $curyear = date("Y"); $curdate = array(); $totalmonths = 24; for ( $i=0; $i<$totalmonths; $i++ ) { $newmonth = date("m",strtotime("-$i Months")); if ($newmonth == '12' && date("m") != '12') $curyear = $curyear-1; $curdate[$i] = array("mnum" => $newmonth, "ynum" => $curyear); } $output = " <?xml version=\"1.0\"> <blocks> <block title=\"Article Archive\"> <links> "; for ( $i=0; $i<$totalmonths; $i++ ) { $output .= "<link target=\"http://www.outdoorresearchverticulture.com/{$curdate[$i]['ynum']}/".$curdate[$i]['mnum']."/?ec3_listing=disable\">". strftime("%B, %Y",strtotime($curdate[$i]['mnum']."/1/".$curdate[$i]['ynum']))." </link> "; } $output .= " </links> </block> </blocks>"; header("Content-Type: application/rss+xml"); echo $output; ?> |
Snippet Source/Credit: Snipplr
How To Create A Custom Sidebar In WordPress
Adding the following snippet in theme’s functions.php file, you will be able to create a custom sidebar in WordPress.
1 2 3 4 5 6 |
register_sidebar(array( 'name' => 'Name-goes-here', 'description' => 'Description goes here', 'before_title' => 'HTML before the sidebar goes here', 'after_title' => 'HTML after the sidebar goes here' )); |
Snippet Source/Credit: Snipplr
How To Have A WordPress Test Post For Development Purpose
Using the following snippet, you will be able to have a WordPress test post ready for development purpose.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
<p>The purpose of this HTML is to help determine what default settings are with CSS and to make sure that all possible HTML Elements are included in this HTML so as to not miss any possible Elements when designing a site.</p> <hr> <h1>Heading 1</h1> <h2>Heading 2</h2> <h3>Heading 3</h3> <h4>Heading 4</h4> <h5>Heading 5</h5> <h6>Heading 6</h6> <p><small><a href="#wrapper">[top]</a></small></p> <hr> <h2 id="paragraph">Paragraph</h2> <p>Lorem ipsum dolor sit amet, <a href="#" title="test link">test link</a> adipiscing elit. Nullam dignissim convallis est. Quisque aliquam. Donec faucibus. Nunc iaculis suscipit dui. Nam sit amet sem. Aliquam libero nisi, imperdiet at, tincidunt nec, gravida vehicula, nisl. Praesent mattis, massa quis luctus fermentum, turpis mi volutpat justo, eu volutpat enim diam eget metus. Maecenas ornare tortor. Donec sed tellus eget sapien fringilla nonummy. Mauris a ante. Suspendisse quam sem, consequat at, commodo vitae, feugiat in, nunc. Morbi imperdiet augue quis tellus.</p> <p>Lorem ipsum dolor sit amet, <em>emphasis</em> consectetuer adipiscing elit. Nullam dignissim convallis est. Quisque aliquam. Donec faucibus. Nunc iaculis suscipit dui. Nam sit amet sem. Aliquam libero nisi, imperdiet at, tincidunt nec, gravida vehicula, nisl. Praesent mattis, massa quis luctus fermentum, turpis mi volutpat justo, eu volutpat enim diam eget metus. Maecenas ornare tortor. Donec sed tellus eget sapien fringilla nonummy. Mauris a ante. Suspendisse quam sem, consequat at, commodo vitae, feugiat in, nunc. Morbi imperdiet augue quis tellus.</p> <p><small><a href="#wrapper">[top]</a></small></p> <hr> <h2 id="list_types">List Types</h2> <h3>Definition List</h3> <dl> <dt>Definition List Title</dt> <dd>This is a definition list division.</dd> </dl> <h3>Ordered List</h3> <ol> <li>List Item 1</li> <li>List Item 2</li> <li>List Item 3</li> </ol> <h3>Unordered List</h3> <ul> <li>List Item 1</li> <li>List Item 2</li> <li>List Item 3</li> </ul> <p><small><a href="#wrapper">[top]</a></small></p> <hr> <h2 id="form_elements">Forms</h2> <fieldset> <legend>Legend</legend> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nullam dignissim convallis est. Quisque aliquam. Donec faucibus. Nunc iaculis suscipit dui. Nam sit amet sem. Aliquam libero nisi, imperdiet at, tincidunt nec, gravida vehicula, nisl. Praesent mattis, massa quis luctus fermentum, turpis mi volutpat justo, eu volutpat enim diam eget metus.</p> <form> <p></p> <h2>Form Element</h2> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nullam dignissim convallis est. Quisque aliquam. Donec faucibus. Nunc iaculis suscipit dui.</p> <p><label for="text_field">Text Field:</label><br> <input type="text" id="text_field"></p> <p><label for="text_area">Text Area:</label><br> <textarea id="text_area"></textarea></p> <p><label for="select_element">Select Element:</label></p> <select name="select_element"> <optgroup label="Option Group 1"> <option value="1">Option 1</option> <option value="2">Option 2</option> <option value="3">Option 3</option> </optgroup> <optgroup label="Option Group 2"> <option value="1">Option 1</option> <option value="2">Option 2</option> <option value="3">Option 3</option> </optgroup> </select> <p><label for="radio_buttons">Radio Buttons:</label></p> <p><input type="radio" class="radio" name="radio_button" value="radio_1"> Radio 1<br><br> <input type="radio" class="radio" name="radio_button" value="radio_2"> Radio 2<br><br> <input type="radio" class="radio" name="radio_button" value="radio_3"> Radio 3<br> </p> <p><label for="checkboxes">Checkboxes:</label></p> <p> <input type="checkbox" class="checkbox" name="checkboxes" value="check_1"> Radio 1<br><br> <input type="checkbox" class="checkbox" name="checkboxes" value="check_2"> Radio 2<br><br> <input type="checkbox" class="checkbox" name="checkboxes" value="check_3"> Radio 3<br> </p> <p><label for="password">Password:</label></p> <p><input type="password" class="password" name="password"> </p> <p><label for="file">File Input:</label><br> <input type="file" class="file" name="file"> </p> <p><input class="button" type="reset" value="Clear"> <input class="button" type="submit" value="Submit"> </p> <p></p> </form> </fieldset> <p><small><a href="#wrapper">[top]</a></small></p> <hr> <h2 id="tables">Tables</h2> <table cellspacing="0" cellpadding="0"> <tbody> <tr> <th>Table Header 1</th> <th>Table Header 2</th> <th>Table Header 3</th> </tr> <tr> <td>Division 1</td> <td>Division 2</td> <td>Division 3</td> </tr> <tr class="even"> <td>Division 1</td> <td>Division 2</td> <td>Division 3</td> </tr> <tr> <td>Division 1</td> <td>Division 2</td> <td>Division 3</td> </tr> </tbody> </table> <p><small><a href="#wrapper">[top]</a></small></p> <hr> <h2 id="misc">Misc Stuff – abbr, acronym, pre, code, sub, sup, etc.</h2> <p>Lorem <sup>superscript</sup> dolor <sub>subscript</sub> amet, consectetuer adipiscing elit. Nullam dignissim convallis est. Quisque aliquam. <cite>cite</cite>. Nunc iaculis suscipit dui. Nam sit amet sem. Aliquam libero nisi, imperdiet at, tincidunt nec, gravida vehicula, nisl. Praesent mattis, massa quis luctus fermentum, turpis mi volutpat justo, eu volutpat enim diam eget metus. Maecenas ornare tortor. Donec sed tellus eget sapien fringilla nonummy. <acronym title="National Basketball Association">NBA</acronym> Mauris a ante. Suspendisse quam sem, consequat at, commodo vitae, feugiat in, nunc. Morbi imperdiet augue quis tellus. <abbr title="Avenue">AVE</abbr></p> <pre> <p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nullam dignissim convallis est. Quisque aliquam. Donec faucibus. Nunc iaculis suscipit dui. Nam sit amet sem. Aliquam libero nisi, imperdiet at, tincidunt nec, gravida vehicula, nisl. Praesent mattis, massa quis luctus fermentum, turpis mi volutpat justo, eu volutpat enim diam eget metus. Maecenas ornare tortor. Donec sed tellus eget sapien fringilla nonummy. <acronym title="National Basketball Association">NBA</acronym> Mauris a ante. Suspendisse quam sem, consequat at, commodo vitae, feugiat in, nunc. Morbi imperdiet augue quis tellus. <abbr title="Avenue">AVE</abbr> </p> </pre> <blockquote> <p>"This stylesheet is going to help so freaking much." <br> -Blockquote</p> </blockquote> <p><small><a href="#wrapper">[top]</a></small><br></p> |
Snippet Source/Credit: Snipplr