Skip to content

Instantly share code, notes, and snippets.

View dospuntocero's full-sized avatar

Francisco arenas dospuntocero

View GitHub Profile
@dospuntocero
dospuntocero / add_input_woocommerce_product.php
Created September 18, 2019 14:54
Add input field to products - WooCommerce
/**
* @snippet Add input field to products - WooCommerce
* @how-to Watch tutorial @ https://businessbloomer.com/?p=19055
* @author Rodolfo Melogli
* @compatible WooCommerce 3.5.7
* @donate $9 https://businessbloomer.com/bloomer-armada/
*/
// -----------------------------------------
// 1. Show custom input field above Add to Cart
@dospuntocero
dospuntocero / variations-add-to-cart.php
Created August 21, 2019 02:04
using a list of variations instead of a combobox on product pages
function woocommerce_variable_add_to_cart() {
global $product, $post;
$variations = $product->get_available_variations();
?>
<table>
<tbody>
<?php
foreach ($variations as $key => $value) {
?>
@dospuntocero
dospuntocero / gist:95941beb334990c3ffd9cfc3fa613ff3
Created August 3, 2019 17:48
install composer globally using mamp's PHP
Create an alias for our bash profile.
Within the terminal, run:
nano ~/.bash_profile
add the following line:
alias phpmamp='/Applications/MAMP/bin/php/php7.3.1/bin/php'
@dospuntocero
dospuntocero / remove-h1.php
Created June 28, 2019 19:10
how to remove h1 from the wordpress classic editor
function remove_h1_from_editor( $settings ) {
$settings['block_formats'] = 'Paragraph=p;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre;';
return $settings;
}
add_filter( 'tiny_mce_before_init', 'remove_h1_from_editor' );
@dospuntocero
dospuntocero / features-list.php
Created June 27, 2019 01:33
getting a list of features from an ACF repeater and split it in 2 different balanced lists
<div class="solution-features-list">
<?php
$features = [];
if ( have_rows( 'features' ) ) :
while ( have_rows( 'features' ) ) : the_row();
array_push($features, get_sub_field( 'feature' ));
endwhile;
@dospuntocero
dospuntocero / show-children-pages.php
Last active June 27, 2019 01:34
show children pages of current page
<div class="solutions-holder">
<div class="wrapper">
<?php
$args = [
'post_parent' => $post->ID,
'post_type' => 'page',
'orderby' => 'menu_order'
];
$child_query = new WP_Query( $args );
@dospuntocero
dospuntocero / complex query
Last active June 13, 2019 02:47
i have a product with 2 taxonomies and i need to filter the ones that belongs to one specific taxonomy and at the same time, order the objects by category
<?php
/**
* Template Name: Product
*/
get_header();
?>
<main class="wrapper">
@dospuntocero
dospuntocero / ACF Country List
Created May 23, 2019 02:18 — forked from yaronguez/ACF Country List
Country list formatted for Advanced Custom Fields select dropdown
afghanistan : Afghanistan
albania : Albania
algeria : Algeria
american_samoa : American Samoa
andorra : Andorra
angola : Angola
anguilla : Anguilla
antigua_and_barbuda : Antigua and Barbuda
argentina : Argentina
armenia : Armenia
@dospuntocero
dospuntocero / search.php
Created May 20, 2019 00:25
order wordpress posts using url variables
//passing variables like ?orderby=title
$my_query = new WP_Query( array(
'post_type' => 'project',
'post_status' => 'publish',
'orderby' => get_query_var('orderby'), // will return orderby query string variable
'order' => 'DESC',
'paged' => get_query_var('paged'),
));
@dospuntocero
dospuntocero / changing the language of windows 10
Last active May 31, 2019 02:07
changing the keyboard configuration on windows 10 - for good. using powershell
if you want to know which keyboards do you have available, use this command
Get-WinUserLanguageList
if you want to add a new one and you know the languagetag and the keyboard layout you want you can use something like this
Set-WinUserLanguageList -LanguageList en-US, en-001 -Force
if you want to remove from the list of posibilities the ones you dont want to use, just do the following (pressing enter after each line):