Skip to content

Instantly share code, notes, and snippets.

View ncesar's full-sized avatar
🎯
Focusing

César Nascimento ncesar

🎯
Focusing
View GitHub Profile
<?php include 'wp-load.php';
//$user = get_user_by( 'email', 'emailcadastrado@email.com' );
$user = get_user_by( 'slug', 'usuario' );
//$user = get_user_by( 'login', 'usuario' );
wp_set_password( "new_password", $user->ID );
// Just use ID=1 for the super admin account
wp_set_password( "new_password", 1 );
@ncesar
ncesar / camposCustomizados.php
Created January 14, 2019 19:22
Campos customizados de registro para o WooCommerce
<?php
/*
Plugin Name: WooCommerce Custom Account Fields
Plugin URI: https://iconicwp.com/blog/the-ultimate-guide-to-adding-custom-woocommerce-user-account-fields/
Description: Add custom WooCommerce user account fields.
Author: Iconic
Version: 1.0.0
Author URI: https://iconicwp.com/products/
*/
@ncesar
ncesar / maskWooCommerce.php
Created January 16, 2019 01:32
Mascarar números ou qualquer outro campo do WooCommerce com plugin específico
/**
* WordPress Plugin: Masks Form Fields v1.2 - https://wordpress.org/plugins/masks-form-fields/
* PHP - Custom script to add mask in input phone the WooCommerce. /wp-content/themes/YOUR-THEME/functions.php
*/
add_action('wp_footer', function () {echo "<script type=\"text/javascript\">jQuery(document).ready(function($){ $(\"input[name='billing_phone']\").mask('(000) 000-0000'); });</script>";}, 111);
/**
* WordPress Plugin: Masks Form Fields v1.2 - https://wordpress.org/plugins/masks-form-fields/
* JavaScript - Custom script to add mask in input phone the WooCommerce.
*/
@ncesar
ncesar / CSSUnclickable.css
Created January 16, 2019 17:51
Unclickable div with CSS
.blocked
{
position:relative;
}
.blocked:after
{
content: '';
position: absolute;
left:0;
right:0;
@ncesar
ncesar / newsletter.html
Created January 17, 2019 21:10
Newsletter
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Salinas</title>
</head>
@ncesar
ncesar / player-in-div.css
Created January 18, 2019 18:21
Adicionar um player em uma div
.thumb {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
width: 170px;
height: 170px;
@media(max-width: 768px){
width: 50px;
height: 50px;
@ncesar
ncesar / register_nav_menus.php
Created January 23, 2019 18:39
//register nav menu and footer nav.
//register nav menu and footer nav for wordpress
register_nav_menus(
array(
'main-nav' => 'Main Navigation',
'footer-nav' => 'Footer Navigation'
)
);
@ncesar
ncesar / autoAddWooCommerceChildren.php
Created January 24, 2019 13:14
Auto add WooCommerce categories children in a wordpress menu
add_filter("wp_get_nav_menu_items", function ($items, $menu, $args) {
if( $menu->term_id != 111 ) return $items ;
// don't add child categories in administration of menus
if (is_admin()) {
return $items;
}
foreach ($items as $index => $i) {
@ncesar
ncesar / removeWooCommerceMenuItem.php
Created January 24, 2019 19:46
Code to remove a WooCommerce menu item
add_filter ( 'woocommerce_account_menu_items', 'misha_remove_my_account_links' );
function misha_remove_my_account_links( $menu_links ){
unset( $menu_links['edit-address'] ); // Addresses
//unset( $menu_links['dashboard'] ); // Remove Dashboard
//unset( $menu_links['payment-methods'] ); // Remove Payment Methods
//unset( $menu_links['orders'] ); // Remove Orders
//unset( $menu_links['downloads'] ); // Disable Downloads
@ncesar
ncesar / customWooCommerceMyAccountPage.php
Created January 24, 2019 20:18
customWooCommerceMyAccountPage
/*
* Step 1. Add Link (Tab) to My Account menu
*/
add_filter ( 'woocommerce_account_menu_items', 'misha_log_history_link', 40 );
function misha_log_history_link( $menu_links ){
$menu_links = array_slice( $menu_links, 0, 5, true )
+ array( 'log-history' => 'Log history' )
+ array_slice( $menu_links, 5, NULL, true );