Skip to content

Instantly share code, notes, and snippets.

@intelliweb
intelliweb / builder_extensions_filter.php
Created November 5, 2013 19:44
Builder: Filter out default extensions, only use extensions provided by child theme
<?php
// Filter out Builder extensions except those provided by the custom child theme
add_filter( 'builder_get_extension_directories', 'intw_set_extensions_directory' );
function intw_set_extensions_directory( $directories ) {
$directories = array(
get_template_directory() . '/extensions',
get_stylesheet_directory() . '/extensions',
);
$directories = array_unique( $directories );
@intelliweb
intelliweb / list_hooked_functions.php
Created October 11, 2013 15:48
WP: List all hooked functions, sorted by priority. Shows all hooked functions in the order they are run as WordPress loads.
<?php
// List all hooked functions, sorted by priority
add_action('wp_head', 'intw_list_hooked_functions');
function intw_list_hooked_functions($tag=false){
global $wp_filter;
if ($tag) {
$hook[$tag]=$wp_filter[$tag];
if (!is_array($hook[$tag])) {
@intelliweb
intelliweb / filter_enter_title_here.php
Created October 9, 2013 18:36
WP: Filter 'Enter title here' text in title field of edit post admin screen to show something different
<?php
// New 'Enter title here' text for custom post type
add_filter('enter_title_here', 'intw_filter_enter_title_here');
function intw_filter_enter_title_here( $message ) {
global $post;
if ('POSTTYPE' == $post->post_type) {
$message = 'NEW MESSAGE';
}
return $message;
@intelliweb
intelliweb / default_wp_robots.txt
Created October 9, 2013 17:59
A good default robots.txt file for WordPress sites
User-agent: *
Disallow: /wp-admin
Disallow: /wp-includes
Disallow: /wp-content/plugins
Disallow: /wp-content/cache
Disallow: /wp-content/themes
Disallow: /wp-includes/js
Disallow: /trackback
Disallow: /category/*/*
Disallow: */trackback
@intelliweb
intelliweb / bootstrap_popover_customizations.md
Created October 6, 2013 17:25
Customizing Twitter Bootstrap's popover behavior to open popovers on click, add close button, and keep popovers open until closed via close button or toggled via trigger link.
@intelliweb
intelliweb / builder_filter_current_layout.php
Created October 5, 2013 07:48
Builder: Filter to assign a layout using layout ID
<?php
add_filter('builder_filter_current_layout', 'intw_builder_filter_current_layout');
function intw_builder_filter_current_layout( $layout_id ) {
if ( is_single() && in_category( 'news' ) )
return '4e5f997043d8e';
return $layout_id;
}
@intelliweb
intelliweb / featured_image_background.php
Created October 4, 2013 02:12
WP: Featured image as background
#replace {
background: url("myimage") 0 0 no-repeat;
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
}
@intelliweb
intelliweb / featured_image.php
Created September 4, 2013 18:52
WP: Featured image as banner with default image if no featured image is selected
@intelliweb
intelliweb / jquery_waypoints.md
Created August 28, 2013 04:49
Use jQuery Waypoints Sticky Elements to create sticky navigation menu

STEP 1

Add the following to theme's functions.php file (modify module type if needed):

// Add Support for Alternate Module Styles
add_action( 'it_libraries_loaded', 'it_builder_loaded' );
if ( ! function_exists( 'it_builder_loaded' ) ) {
  function it_builder_loaded() {
		builder_register_module_style( 'navigation', 'Sticky Navigation', 'navigation-sticky' );
	}