This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div id="output"></div> | |
| <a href="javascript:prevPage()" id="btn_prev">Prev</a> | |
| <ul id="pages"></ul> | |
| <a href="javascript:nextPage()" id="btn_next">Next</a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $post_type = 'post'; | |
| $author_id = 1; | |
| $titles = array( | |
| "Post Title" | |
| "Something Else" | |
| ); | |
| /*** No need to edit below here ***/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Couldn't find copy/paste code anywhere so I wrote it myself. The interwebz failed me. | |
| */ | |
| /** The category ID's with the posts you want to change */ | |
| $category_ids = array(48, 50, 51, 52, 53); // array of ints or single int | |
| /** The shipping class to set for the products */ | |
| $shipping_class_slug = "postcards"; // found in "shipping classes" in woocommerce settings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Assumes you have the months and years already set up in your HTML | |
| */ | |
| function generateDays() | |
| { | |
| const thisYear = new Date().getFullYear(); | |
| const thisMonth = new Date().getMonth(); | |
| // Where XXX is your 'select' element ID for the Year | |
| // Where YYY is your 'select' element ID for the Month |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* NOTE: you do not need to pass `elem` to callBack, it is optional. | |
| USAGE: | |
| This is the es5/jquery implementation */ | |
| _isElement('.some_selector', function(elem) { | |
| console.log(elem + ' exists.'); | |
| }); | |
| /* Vanilla JS/ES5 */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function render_month_dropdown($select_name, $id, $label, $selected_month) | |
| { | |
| $dropdown = '<label for="' . $select_name . '">' . $label . '</label>'; | |
| $dropdown .= '<select id="' . $id . '" name="' . $select_name . '">'; | |
| $months = array( | |
| 'January', | |
| 'February', | |
| 'March', | |
| 'April', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* Helper function for debugging entities - Drupal 7 */ | |
| function debug_entity($w) { | |
| $values = array(); | |
| foreach ($w->getPropertyInfo() as $key => $val) { | |
| $values[$key] = $w->$key->value(); | |
| } | |
| return $values; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $sortMe = array( | |
| "item" => "Title", | |
| "item" => "Another Title", | |
| ); | |
| $arr = array(); | |
| foreach ($sortMe as $key => $row) | |
| { | |
| $arr[$key] = $row['item']; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Returns a clean url slug | |
| function wp_slug($string) | |
| { | |
| return rtrim(strtolower(trim(preg_replace('/[^A-Za-z0-9-]+/', '-', $string))), "-"); | |
| } | |
| // Items to convert to slug | |
| $items = array( | |
| "Item #1", | |
| "Item #2 ", // Dirty input - Trailing space |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var startDate, endDate; | |
| startDate = 1900; | |
| endDate = 2000; | |
| /** No more editing */ | |
| document.write(startDate + "<br>"); | |
| while (startDate !== endDate) | |
| { |
NewerOlder