Skip to content

Instantly share code, notes, and snippets.

View jhimross's full-sized avatar

Jhimross Olinares jhimross

View GitHub Profile
@jhimross
jhimross / gist:8965b8d19f031eda252bfeccb7627d92
Last active August 15, 2023 05:25
Songs - Custom Post Type
function custom_song_post_type() {
register_post_type('song', array(
'labels' => array(
'name' => 'Songs',
'singular_name' => 'Song',
),
'public' => true,
'has_archive' => true,
'supports' => array('title', 'editor', 'thumbnail'),
));
var input = $('#inputfield')[0]
var ev = $.Event('keyup')
ev.which = 32
setInterval(function() {
if ($('.highlight')[0]) {
input.focus()
input.value = $('.highlight').text()
$(input).trigger(ev)
}
}, 100)
@jhimross
jhimross / gist:71aaebeb2f2668935935f398245af798
Created July 26, 2022 07:46
Trigger Orderable Floating Cart in the Cart Icon of the Theme
jQuery(document).on( "click", ".header-cart-button", function(e) {
e.preventDefault();
jQuery('.orderable-floating-cart__button').trigger('click');
});
@jhimross
jhimross / remove_wpauto_p.txt
Last active July 21, 2022 02:10
Prevent WP from adding <p> tags on all post types
// Prevent WP from adding <p> tags on all post types
function disable_wp_auto_p( $content ) {
remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );
return $content;
}
add_filter( 'the_content', 'disable_wp_auto_p', 0 );
@jhimross
jhimross / CSS for Orderable Live View
Created June 10, 2022 02:28
CSS for Orderable Live View
add_action(
'admin_footer',
function() {
if ( ! class_exists( 'Orderable_Live_View' ) ) {
return;
}
if ( ! Orderable_Live_View::is_live_view() ) {
return;
}
@jhimross
jhimross / Disable Attributes Fee
Created June 8, 2022 14:08
Disable Attributes Fee
/**
* Disable Attribute Swatches fee functionality.
*/
add_filter( 'iconic_was_disable_fees', '__return_true' );
add_filter('yith_wccl_enable_handle_variation_gallery','__return_false');
@jhimross
jhimross / Change Quantity Arrow to plus-minus
Created May 20, 2022 05:54
Change Quantity Arrow to plus-minus
// 1. Show Buttons
add_action( 'woocommerce_before_add_to_cart_quantity', 'iconic_display_quantity_plus' );
function iconic_display_quantity_plus() {
echo '<button type="button" class="plus" >+</button>';
}
add_action( 'woocommerce_after_add_to_cart_quantity', 'iconic_display_quantity_minus' );
@jhimross
jhimross / gist:795381c4405ee0aaa01797ef079477ee
Created May 13, 2022 05:00
FluxCheckout Allow Theme Styling
/**
* Iconic Flux checkout allow theme's style.css.
*
* @param array $allowed Array of allowed sources.
*
* @return array
*/
function iconic_flux_allow_themes_style_on_checkout( $allowed ) {
$allowed[] = get_stylesheet_uri().'?b';
$allowed[] = get_template_directory_uri() . '/assets/css/styles.css';
@jhimross
jhimross / gist:011e5aecb15979101a852808f067112d
Created April 8, 2022 10:51
Change min/max date for admin
/**
* Change min/max date for admin
*
* @return void
*/
function iconic_admin_set_min_date() {
global $iconic_wds;
if ( empty( $iconic_wds ) || ! current_user_can( 'manage_woocommerce' ) ) {