Skip to content

Instantly share code, notes, and snippets.

@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#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/
@jameskoster
jameskoster / functions.php
Created January 12, 2013 16:01
WooCommerce - hide ratings on product loop
// Remove the product rating display on product loops
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );
@justintadlock
justintadlock / register-post-type.php
Last active July 17, 2024 10:14
Help file when registering post types.
<?php
# Register custom post types on the 'init' hook.
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 1.0.0
* @access public
<?php
//Tested in a theme's functions.php, but not in a plugin
//Allow overriding of editor
class opubco_user_optin {
public function __construct() {
add_action( 'personal_options', array( &$this, 'add_interface' ) );
//User update action
add_action( 'edit_user_profile_update', array( &$this, 'save_user_profile' ) );
@ronalfy
ronalfy / nest-nav-menu.php
Created December 10, 2015 21:13
Add new line back into LI
/* Place in header just above where you output your menu */
<?php
class nest_nav_menu extends Walker_Nav_Menu {
function end_el( &$output, $item, $depth = 0, $args = array() ) {
$output .= "</li>\n";
}
}
?>
<?php wp_nav_menu( array( 'theme_location' => 'header-menu', 'walker' => new nest_nav_menu ) ); ?>
@vanbo
vanbo / wc-css-make-storefront-product-tabs-horizontal
Created October 27, 2017 11:33
WooCommerce: CSS to make Storefront product tabs horizontal again
.product .woocommerce-tabs ul.tabs {
width: 100%;
float: none;
margin-right: 5.8823529412%;
}
.woocommerce div.product .woocommerce-tabs ul.tabs {
list-style: none;
padding: 0 0 0 1em;
margin: 0 0 1.618em;