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
| # Source: https://premium.wpmudev.org/blog/shun-the-plugin-100-wordpress-code-snippets-from-across-the-net/ | |
| <Files wp-config.php> | |
| order allow,deny | |
| deny from all | |
| </Files> | |
| ## EXPIRES CACHING ## | |
| ExpiresActive On | |
| ExpiresByType image/jpg "access 1 year" |
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
| /* | |
| * Source: https://premium.wpmudev.org/blog/shun-the-plugin-100-wordpress-code-snippets-from-across-the-net/ | |
| */ | |
| <?php wp_enqueue_script("jquery"); ?> |
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
| /* | |
| * Source: https://premium.wpmudev.org/blog/shun-the-plugin-100-wordpress-code-snippets-from-across-the-net/ | |
| * Documentation: https://developer.wordpress.org/reference/hooks/excerpt_length/ | |
| */ | |
| function new_excerpt_length($length) { | |
| return 20; | |
| } | |
| add_filter('excerpt_length', 'new_excerpt_length'); |
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
| /* | |
| * Source: https://premium.wpmudev.org/blog/shun-the-plugin-100-wordpress-code-snippets-from-across-the-net/ | |
| * Documentation: https://developer.wordpress.org/reference/functions/wp_tag_cloud/ | |
| */ | |
| wp_tag_cloud(array( | |
| 'smallest' => 10, // size of least used tag | |
| 'largest' => 18, // size of most used tag | |
| 'unit' => 'px', // unit for sizing | |
| 'orderby' => 'name', // alphabetical |
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
| /* | |
| * Source: https://speckyboy.com/wordpress-snippets-extend-wordpress/ | |
| * Documentation: https://developer.wordpress.org/reference/functions/add_shortcode/ | |
| */ | |
| function helloworld() { | |
| return 'Hello World!'; | |
| } | |
| add_shortcode('hello', 'helloworld'); |
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
| /* | |
| * Redirect to a single WordPress post if there's only one in/with a given category/tag | |
| * Source: https://speckyboy.com/wordpress-snippets-extend-wordpress/ | |
| * Documentation: https://developer.wordpress.org/reference/hooks/template_redirect/ | |
| */ | |
| function stf_redirect_to_post(){ | |
| global $wp_query; | |
| // If there is one post on archive page | |
| if( is_archive() && $wp_query->post_count == 1 ){ |
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 | |
| /* | |
| * Source: https://speckyboy.com/wordpress-snippets-extend-wordpress/ | |
| */ | |
| ?> | |
| <?php | |
| $my_query = new WP_Query('post_status=future&order=DESC&showposts=5'); | |
| if ($my_query->have_posts()) { | |
| <ul> |
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
| /* | |
| * Based on Eric Meyer's reset: https://meyerweb.com/eric/tools/css/reset/ | |
| * Source: https://www.hongkiat.com/blog/css-snippets-for-designers/ | |
| */ | |
| html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { | |
| margin: 0; | |
| padding: 0; | |
| border: 0; | |
| font-size: 100%; |
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
| /* | |
| * Based on Nicolas Gallagher's micro clearfix hack | |
| */ | |
| .clearfix:before, .container:after { content: ""; display: table; } | |
| .clearfix:after { clear: both; } | |
| /* IE 6/7 */ | |
| .clearfix { zoom: 1; } |
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
| /* | |
| * Adapted from this article on CSS-Tricks: https://css-tricks.com/snippets/css/media-queries-for-standard-devices/ | |
| */ | |
| /* Smartphones (portrait and landscape) ----------- */ | |
| @media only screen | |
| and (min-device-width : 320px) and (max-device-width : 480px) { | |
| /* Styles */ | |
| } | |
OlderNewer