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
| $myterms = get_terms('retouch_types', 'orderby=none&hide_empty'); | |
| foreach ($myterms as $term) { | |
| setup_postdata($post); | |
| $term->name; | |
| //select posts in this category, and of a specified content type | |
| $posts = get_posts( array( | |
| 'post_type' => 'retouch', | |
| 'tax_query' => array( |
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
| if (stripos($_SERVER['SERVER_NAME'], '.local')) { | |
| // localhost | |
| } elseif (stripos($_SERVER['SERVER_NAME'], 'dev.tevashov.ru')) { | |
| // development | |
| } else { | |
| // production | |
| } |
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
| // do something with foo if foo is truthy | |
| foo && doSomething(foo); | |
| // set bar to baz if baz is truthy; | |
| // otherwise, set it to the return | |
| // value of createBar() | |
| var bar = baz || createBar(); |
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
| function my_custom_fonts() { | |
| echo '<style> | |
| body, td, textarea, input, select { | |
| font-family: "Lucida Grande"; | |
| font-size: 12px; | |
| } | |
| </style>'; | |
| } | |
| add_action('admin_head', 'my_custom_fonts'); |
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 foo = 1; | |
| var bar = '2'; | |
| console.log(foo + bar); // 12. uh oh | |
| // coerce the string to a number (see also parseInt()) | |
| console.log(foo + Number(bar)); | |
| // Forcing a string to act as a number (using the unary-plus operator) | |
| console.log(foo + +bar); |
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
| function runAlertNow () { | |
| $(this).html('I just ran this function!'); | |
| } | |
| // both of these lines do the same thing | |
| $('#test').slideUp(400, runAlertNow); | |
| $('#test').slideUp(400, function () | |
| { | |
| $(this).html('I just ran the anonymous function!'); | |
| }); |
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
| // TRUE | |
| '0'; | |
| 'any string'; | |
| []; // an empty array | |
| {}; // an empty object | |
| 1; // any non-zero number | |
| // FALSE |
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
| if ($(selector).length) { | |
| // your code 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
| $("$some[id]").show(); // won't work for this type of ID | |
| $("$some\\[id\\]").show() // works fine for the ID: some[id] | |
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
| $.fn.slideFadeToggle = function(speed, easing, callback) { | |
| return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback); | |
| }; | |
| // Usage: | |
| $("#something").click(function() { | |
| $(this).slideFadeToggle(); | |
| }); |
OlderNewer