Skip to content

Instantly share code, notes, and snippets.

View dexit's full-sized avatar
🎯
Focusing

Rihards Mantejs dexit

🎯
Focusing
View GitHub Profile
@dexit
dexit / woologin.php
Created December 16, 2024 16:27 — forked from neilgee/woologin.php
Add WooCommerce MyAccount Login/Logout Menu Items to Registered Menu
<?php //<~ don't add me in
add_filter( 'wp_nav_menu_items', 'my_account_loginout_link', 10, 2 );
/**
* Add WooCommerce My Account Login/Logout to Registered Menu
*
* @link https://support.woothemes.com/hc/en-us/articles/203106357-Add-Login-Logout-Links-To-The-Custom-Primary-Menu-Area
*/
function my_account_loginout_link( $items, $args ) {
if (is_user_logged_in() && $args->theme_location == 'primary') { //change your theme registered menu name to suit
@dexit
dexit / functions.php
Created December 16, 2024 16:27 — forked from paaljoachim/functions.php
Tutorial: WooCommerce Checkout: Add multiple custom fields to billing area. This code adds priority placement of field. Shows the custom fields in the backend Order Details screen and in e-mails to the admin and customer. I have also adjusted the checkbox field to give a text result instead of a value of 1. Checkbox is also pre-selected.
/* --------- Adds custom fields using filters. ------
The below custom fields shows various types one can use.
It is then displayed in the backend Order Details page and in admin and customer e-mails.
Checkboxes by default result only show the number 1 when clicked. I have added code so that when the a checkbox is clicked it will
show text such as On and Yes. Checkbox is also pre-selected.
Tutorial: https://easywebdesigntutorials.com/woocommerce-modifying-the-checkout-page/
*/
// Initial inspiration: https://businessbloomer.com/woocommerce-add-shipping-phone-checkout/
// My Custom Fields
@dexit
dexit / upload-patentino-woocommerce-login-checkout-page-conditional-cateogry-product-array-json.php Conditional category product with custom field input file (patentino) into Woocommerce page login and checkout - Array JSON
<?php
/**
* File Upload @ WooCommerce My Account Registration
*/
// --------------
// 1. Add file input to register form
@dexit
dexit / upload-patentino-woocommerce-login-checkout-page.php
Created December 16, 2024 16:25 — forked from FrancoStino/upload-patentino-woocommerce-login-checkout-page.php
Custom field input file (patentino) into Woocommerce page login and checkout
<?php
/**
* File Upload @ WooCommerce My Account Registration
*/
// --------------
// 1. Add file input to register form
@dexit
dexit / add_tab_myaccount.php
Created December 16, 2024 16:25 — forked from em-piguet/add_tab_myaccount.php
WOOCOMMERCE add page in my account
<?php
/**
* Ajoute un tab/endpoints dans la partie mon compte
* https://nicola.blog/2017/08/01/add-enquiry-form-my-account-woocommerce-contact-form-7/
*
*/
class WC_Custom_My_Account_Tabs extends WC_Query {
/**
* Adds main filters and actions and inits the endpoints.
@dexit
dexit / code.php
Created December 16, 2024 16:23 — forked from samueleastdev/code.php
Easily Extend Woocommerce Account Page With Custom Menu And Template
<?php
function streamium_add_watchlist_endpoint() {
add_rewrite_endpoint( 'watchlist', EP_ROOT | EP_PAGES );
}
add_action( 'init', 'streamium_add_watchlist_endpoint' );
<?php
/**
* Plugin Name: WooCommerce Custom Account Tabs
* Plugin URI: https://www.example.com/
* description: PHP Class to generate new account tabs for WooCommerce My Account page
* Version: 1.0
* Author:
* Author URI: https://gist.github.com/JiveDig/0d3658676127f30a098859228fc5d8eb
* License: GPL2
@dexit
dexit / register.php
Created December 16, 2024 16:23 — forked from nomanur/register.php
woocommerce custom registration field on account
<?php
/**
* Plugin Name: WooCommerce Registration Fields
* Description: My Custom registration fields.
* Version: 1.0
* Author: Antonio Crespo
* License: GPL2
*/
/* Extra Fields in WooCommerce Registration */
@dexit
dexit / wp_robots.txt
Created December 16, 2024 16:22 — forked from mksddn/wp_robots.txt
robots.txt for WordPress
User-agent: * # Создаем секцию правил для роботов. * значит для всех
# роботов. Чтобы указать секцию правил для отдельного
# робота, вместо * укажите его имя: GoogleBot, Yandex.
Disallow: /cgi-bin # Стандартная папка на хостинге.
Disallow: /wp-admin/ # Закрываем админку.
Allow: /wp-admin/admin-ajax.php # Откроем аякс.
Disallow: /? # Все параметры запроса на главной.
Disallow: *?s= # Поиск.
Disallow: *&s= # Поиск.
Disallow: /search # Поиск.
//Display Fields
add_action( 'woocommerce_product_after_variable_attributes', 'variable_fields', 10, 2 );
//JS to add fields for new variations
add_action( 'woocommerce_product_after_variable_attributes_js', 'variable_fields_js' );
//Save variation fields
add_action( 'woocommerce_process_product_meta_variable', 'variable_fields_process', 10, 1 );
function variable_fields( $loop, $variation_data ) { ?>
<tr>
<td>