Skip to content

Instantly share code, notes, and snippets.

@ofernandolopes
ofernandolopes / .htaccess
Last active February 18, 2017 21:37 — forked from allysonsouza/.htaccess
Enabling PHP 7 on Hostgator trough htaccess - Ativar PHP 7 no Hostgator usando o arquivo htaccess
# Habilitar o PHP 7.0
AddHandler application/x-httpd-php70 .php
<IfModule mod_suphp.c>
suPHP_ConfigPath /opt/php70/lib
</IfModule>
@ofernandolopes
ofernandolopes / Add All Brazilian Cities WP Database
Created January 17, 2017 08:08 — forked from guilhermealveslopes/Add All Brazilian Cities WP Database
Para Criar taxonomia com todas as cidades brasileiras
INSERT INTO `wp_terms` (`term_id`, `name`, `slug`, `term_group`) VALUES
(63, 'AC', 'ac', 0),
(64, 'Acre', 'acre', 0),
(65, 'Acrelândia', 'acrelandia', 0),
(66, 'Assis Brasil', 'assis-brasil', 0),
(67, 'Brasiléia', 'brasileia', 0),
(68, 'Bujari', 'bujari', 0),
(69, 'Capixaba', 'capixaba', 0),
(70, 'Cruzeiro do Sul', 'cruzeiro-do-sul', 0),
@ofernandolopes
ofernandolopes / woocommerce-modify-orderby.php
Created March 10, 2016 03:35 — forked from BFTrick/woocommerce-modify-orderby.php
A function that modifies the default WooCommerce orderby dropdown. You can put this snippet in your functions.php file.
<?php
// Modify the default WooCommerce orderby dropdown
//
// Options: menu_order, popularity, rating, date, price, price-desc
// In this example I'm removing price & price-desc but you can remove any of the options
function my_woocommerce_catalog_orderby( $orderby ) {
unset($orderby["price"]);
unset($orderby["price-desc"]);
return $orderby;
}
@ofernandolopes
ofernandolopes / replace-wp-dashboard.php
Created February 24, 2016 11:06 — forked from wpscholar/replace-wp-dashboard.php
Replace the default WordPress dashboard with a custom one
<?php
/**
* Plugin Name: Replace WordPress Dashboard
* Description: Replaces the default WordPress dashboard with a custom one.
* Author: Micah Wood
* Author URI: http://micahwood.me
* Version: 0.1
* License: GPL3
*/
@ofernandolopes
ofernandolopes / wc-disable-any-repeat-purchase.php
Created January 13, 2016 05:51 — forked from bekarice/wc-disable-any-repeat-purchase.php
Disables Repeat Purchase for any WooCommerce product
<?php
/**
* Disables repeat purchase for products / variations
*
* @param bool $purchasable true if product can be purchased
* @param \WC_Product $product the WooCommerce product
* @return bool $purchasable the updated is_purchasable check
*/
function sv_disable_repeat_purchase( $purchasable, $product ) {
@ofernandolopes
ofernandolopes / functions.php
Last active December 13, 2015 04:49 — forked from bryceadams/gist:f9b9f2c0ea41272754a4
WooCommerce - Disabling the Reviews Tab
add_filter( 'woocommerce_product_tabs', 'wcs_woo_remove_reviews_tab', 98 );
function wcs_woo_remove_reviews_tab($tabs) {
unset($tabs['reviews']);
return $tabs;
}
@ofernandolopes
ofernandolopes / functions.php
Last active August 29, 2015 14:27 — forked from eltondev/functions.php
Hide Cupom Cart / Checkout WooCommerce
<?php
// hide coupon on cart
function hide_coupon_on_cart( $enabled ) {
if ( is_cart() ) {
$enabled = false;
}
return $enabled;
}
add_filter( 'woocommerce_coupons_enabled', 'hide_coupon_on_cart' );
/*Hide items from menubar*/
function wps_admin_bar() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('wp-logo');
$wp_admin_bar->remove_menu('about');
$wp_admin_bar->remove_menu('wporg');
$wp_admin_bar->remove_menu('documentation');
$wp_admin_bar->remove_menu('support-forums');
$wp_admin_bar->remove_menu('feedback');
<?php
/*
*
*
* REMOVER WORDPRESS SUBMENU EN ADMIN BAR
*
*
*/
if (!current_user_can('administrator')):
@ofernandolopes
ofernandolopes / functions.php
Last active August 29, 2015 14:25
WordPress - Remove items from the admin bar to not administrators
<?php
// Remove items from the admin bar to not administrators
add_action( 'wp_before_admin_bar_render', 'hide_before_admin_bar_render' );
function hide_before_admin_bar_render() {
if (!current_user_can('administrator')) {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('wp-logo'); //WordPress Logo
$wp_admin_bar->remove_menu('site-name'); //Site Name
$wp_admin_bar->remove_menu('view-site'); //View Site
$wp_admin_bar->remove_menu('comments'); //Comments