Skip to content

Instantly share code, notes, and snippets.

View sachyya's full-sized avatar
🏠
Working from home

sachyya sachyya

🏠
Working from home
View GitHub Profile
@sachyya
sachyya / add-to-cart-text.php
Last active September 18, 2020 07:41
Change add to cart text for Zoom Meeting product
<?php
add_filter( 'woocommerce_product_add_to_cart_text', function( $text, $instance ) {
$product_type = $instance->get_type();
if( 'zoom_meeting' === $product_type ) {
return esc_html__( 'Add to Cart', 'theme-slug' );
}
return $text;
}, 10, 2 );
<?php
function theme_slug_disable_meeting_before_minutes( $response, $meeting_id ) {
$meeting_details = get_post_meta( $meeting_id, '_meeting_zoom_details', true );
if ( ! empty( $meeting_details ) && is_object( $meeting_details ) ) {
if ( $meeting_details->type === 8 || $meeting_details->type === 3 ) {
$meeting_details->start_time = false;
}
Do as the insturction to install create-react-app until npm start cmd.
Visit the ip of the VVV i.e.192.168.50.4:(provided port)
Then, create a .env file in the project folder and write the code "CHOKIDAR_USEPOLLING=true" to the file and restart npm.
@sachyya
sachyya / Trick Jetpack
Last active January 24, 2018 09:45
Trick jetpack as if it is connected to WordPress.com
1. Go to plugins/jetpack/class.jetpack-data.php
2. In the file, below get_access_token fn: return true;
@sachyya
sachyya / wp-42573.php
Created November 24, 2017 08:46 — forked from westonruter/wp-42573.php
WP Trac #42573: Fix for theme template caching. https://core.trac.wordpress.org/ticket/42573
<?php
/**
* Plugin name: WP Trac #42573: Fix for theme template file caching.
* Description: Flush the theme file cache each time the admin screens are loaded which uses the file list.
* Plugin URI: https://core.trac.wordpress.org/ticket/42573
* Author: Weston Ruter, XWP.
* Author URI: https://weston.ruter.net
*/
function wp_42573_fix_template_caching( WP_Screen $current_screen ) {
@sachyya
sachyya / stars-block.js
Created October 4, 2017 17:25 — forked from pento/stars-block.js
Gutenberg Stars Block
( function( blocks, element ) {
var el = element.createElement;
function Stars( { stars } ) {
return el( 'div', { key: 'stars' },
'★'.repeat( stars ),
( ( stars * 2 ) % 2 ) ? '½' : '' );
}
blocks.registerBlockType( 'stars/stars-block', {
@sachyya
sachyya / user-customizer-configure
Created February 9, 2017 10:36
This code is to show user to go to specific section to configure that section in a theme.
<?php
if ( current_user_can( 'customize' ) ) { ?>
<div class="message">
<p><?php _e( 'There are no pages available to display.', 'textdomain' ); ?></p>
<p><?php printf(
__( 'These pages can be set in the <a href="%s">customizer</a>.', 'textdomain' ),
admin_url( 'customize.php?autofocus[control]=showcase' )
); ?>
</p>
/***************************************************/
## Social share buttons.
/***************************************************/
function sachyya_social_sharing_buttons() {
global $post;
// Show this on post only.
// Get current page URL
$shortURL = get_permalink();
/**
<?php
* Descriptions on Header Menu
* @link https://codex.wordpress.org/Class_Reference/Walker
*
* @param string $item_output, HTML outputp for the menu item
* @param object $item, menu item object
* @param int $depth, depth in menu structure
* @param object $args, arguments passed to wp_nav_menu()
* @return string $item_output