##Sass Functions Cheat Sheet
| add_filter( 'genesis_search_text', 'custom_search_text' ); | |
| /** | |
| * Customizes the text of the search input | |
| * | |
| * @param string $text current text | |
| * @return string modified text | |
| */ | |
| function custom_search_text( $text ) { | |
| return esc_attr( 'Google Search...' ); | |
| } |
| // Filter the title with a custom function | |
| add_filter('genesis_seo_title', 'wap_site_title' ); | |
| // Add additional custom style to site header | |
| function wap_site_title( $title ) { | |
| // Change $custom_title text as you wish | |
| $custom_title = '<span class="custom-title">WA</span>Estate'; | |
| // Don't change the rest of this on down |
| <?php | |
| add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' ); | |
| /** | |
| * Example callback function that demonstrates how to properly enqueue conditional stylesheets in WordPress for IE. | |
| * IE10 and up does not support conditional comments in standards mode. | |
| * | |
| * @uses wp_style_add_data() WordPress function to add the conditional data. | |
| * @link https://developer.wordpress.org/reference/functions/wp_style_add_data/ |
⇐ back to the gist-blog at jrw.fi
Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.
I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.
This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso
| // Replace 7 with the ID of your form and 13 with the ID of the field you want to force "all required" | |
| // http://www.gravityhelp.com/documentation/page/Gform_field_validation | |
| add_filter("gform_field_validation_7_13", 'validate_tcs', 10, 4); | |
| function validate_tcs($result, $value, $form, $field) { | |
| // Convert the checkbox input name value (returned as part of "field") | |
| // into the "underscored" ID version which is found in the $_POST | |
| foreach ($field['inputs'] as $input) { | |
| $input_post_value = 'input_' . str_replace('.', '_', $input['id']); | |
| #301 Redirects for .htaccess | |
| #Redirect a single page: | |
| Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
| #Redirect an entire site: | |
| Redirect 301 / http://www.domain.com/ | |
| #Redirect an entire site to a sub folder | |
| Redirect 301 / http://www.domain.com/subfolder/ |
| <?php | |
| //absolute path to wp-load.php, or relative to this script | |
| //e.g., ../wp-core/wp-load.php | |
| include( 'trunk/wp-load.php' ); | |
| //grab the WPDB database object, using WP's database | |
| //more info: http://codex.wordpress.org/Class_Reference/wpdb | |
| global $wpdb; |