Skip to content

Instantly share code, notes, and snippets.

View silvaitamar's full-sized avatar
🤝

Itamar Silva silvaitamar

🤝
View GitHub Profile
@webprom
webprom / filters.php
Created October 23, 2021 07:17 — forked from dkjensen/filters.php
WordPress Gutenberg Query Loop View More AJAX
<?php
/**
* Add data attributes to the query block to describe the block query.
*
* @param string $block_content Default query content.
* @param array $block Parsed block.
* @return string
*/
function query_render_block( $block_content, $block ) {
if ( 'core/query' === $block['blockName'] ) {
@sekanderb
sekanderb / do_enrol.php
Last active April 13, 2025 00:19
Enroll students programmatically in Tutor LMS. Documentation link- https://docs.themeum.com/tutor-lms/developers/programmatically-enroll-students/
public function do_enroll($course_id = 0, $order_id = 0, $user_id = 0){
if ( ! $course_id){
return false;
}
do_action('tutor_before_enroll', $course_id);
$user_id = $this->get_user_id($user_id);
$title = __('Course Enrolled', 'tutor')." &ndash; ".date_i18n(get_option('date_format')) .' @ '.date_i18n(get_option('time_format') ) ;
@woogists
woogists / wc-products-displayed-per-page.php
Last active April 24, 2025 20:12
[Theming Snippets] Change number of products displayed per page
/**
* Change number of products that are displayed per page (shop page)
*/
add_filter( 'loop_shop_per_page', 'new_loop_shop_per_page', 20 );
function new_loop_shop_per_page( $cols ) {
// $cols contains the current number of products per page based on the value stored on Options -> Reading
// Return the number of products you wanna show per page.
$cols = 9;
return $cols;
@mariovalney
mariovalney / woo-enable-reviews-bulk-edit.php
Created August 7, 2017 19:55
WooCommerce Enable Reviews - Bulk Edit
<?php
/**
*
* Plugin Name: WooCommerce Enable Reviews - Bulk Edit
* Description: Allow enable reviews by bulk edit into WooCommerce
* Version: 1.0.0
* Author: Mário Valney
* Author URI: http://mariovalney.com
* Text Domain: woo-enable-reviews-bulk-edit
*
@0xjac
0xjac / private_fork.md
Last active October 30, 2025 04:53
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare [email protected]:usi-systems/easytrace.git

@hasanm95
hasanm95 / bootstrap carousel with multiple items - wordpress
Created September 8, 2016 08:56
bootstrap carousel with multiple items in wordpress/ custom post / cmb2( Group field)
@adityasatrio
adityasatrio / MySqlBackup.bat
Created July 1, 2015 04:02
Mysql Backup Script For Windows
@echo off
set dbUser=root
set dbPassword=password
set backupDir="F:\AdityaSatrioNugroho\testbackupDb-bat\"
set mysqldump="C:\xampp\mysql\bin\mysqldump.exe"
set mysqlDataDir="C:\xampp\mysql\data"
set zip="C:\Program Files\7-Zip\7z.exe"
:: get date
@damianwajer
damianwajer / admin.js
Last active April 17, 2018 10:46
[WordPress] Conditional Meta Box / Custom fields depending on page template in WP Admin
jQuery( document ).ready( function ( $ ) {
var $pageTemplate = $( "#page_template" ),
$metaBoxID = $( "#meta_box_id" );
$pageTemplate.on( "change", function () {
if ( $( this ).val() == "templates/page-custom.php" ) {
$metaBoxID.show();
} else {
$metaBoxID.hide();
}
@claudiosanches
claudiosanches / functions.php
Created June 8, 2014 22:23
WooCommerce - Change product loop add to cart button
<?php
function custom_woocommerce_loop_add_to_cart_link( $html, $product ) {
return '<a href="' . get_permalink( $product->id ) . '" class="button">' . __( 'Texto do botão' ) . '</a>';
}
add_filter( 'woocommerce_loop_add_to_cart_link', 'custom_woocommerce_loop_add_to_cart_link', 10, 2 );
@cassiocardoso
cassiocardoso / select-estados-br
Created February 12, 2014 23:31
Select com uma lista de todos os estados brasileiros.
<select name="estados-brasil">
<option value="AC">Acre</option>
<option value="AL">Alagoas</option>
<option value="AP">Amapá</option>
<option value="AM">Amazonas</option>
<option value="BA">Bahia</option>
<option value="CE">Ceará</option>
<option value="DF">Distrito Federal</option>
<option value="ES">Espírito Santo</option>
<option value="GO">Goiás</option>