Skip to content

Instantly share code, notes, and snippets.

View INDIAN2020's full-sized avatar

Gogula Sivannarayana INDIAN2020

View GitHub Profile
@INDIAN2020
INDIAN2020 / remove-cart-from-menu.php
Created June 18, 2018 06:20 — forked from yanknudtskov/remove-cart-from-menu.php
Remove cart from menu in Enfold theme #enfold #woocommerce
<?php
add_action( 'after_setup_theme', 'enfold_woocommerce_child_theme_code' );
function enfold_woocommerce_child_theme_code() {
remove_action( 'init', 'avia_woocommerce_cart_placement', 10);
}
@INDIAN2020
INDIAN2020 / child-theme-language-override.php
Created June 18, 2018 06:20 — forked from yanknudtskov/child-theme-language-override.php
Override Enfold language files in Child Theme #enfold #translation
<?php
/**
* Override Language Files for Enfold Child Theme
*/
function yanco_overwrite_language_file_child_theme() {
$lang = get_stylesheet_directory().'/lang';
return $lang;
}
add_filter('ava_theme_textdomain_path', 'yanco_overwrite_language_file_child_theme');
@INDIAN2020
INDIAN2020 / list-navigation-tree-for-pages.php
Created June 18, 2018 06:19 — forked from yanknudtskov/list-navigation-tree-for-pages.php
List Navigation Tree for Pages #navigation
<?php
/*
* Get Ancenstor / Top Parent Page ID
*/
function get_top_parent_page_id() {
global $post;
$ancestors = $post->ancestors;
@INDIAN2020
INDIAN2020 / wp-config-debug.php
Created June 18, 2018 06:18 — forked from yanknudtskov/wp-config-debug.php
WP Debugging Insert this into wp-config.php to enable a more diversified debugging of WordPress
<?php
define( 'WP_DEBUG', false );
define( 'WP_DEVELOPMENT_MODE', false );
if ( WP_DEBUG ) {
define ('JETPACK_DEV_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'SCRIPT_DEBUG', true );
@INDIAN2020
INDIAN2020 / cpt-menu.php
Created June 18, 2018 06:17 — forked from yanknudtskov/cpt-menu.php
Fetching a custom WordPress Menu with Custom Post Types #enfold
<?php
$html = '';
// Get all Child Pages
$args_1 = array(
'post_status' => 'publish',
'post_type' => 'custom_post_type_1',
'orderby' => 'title',
'order' => 'ASC',
@INDIAN2020
INDIAN2020 / function-get-latlng-google-maps-api.php
Created June 18, 2018 06:16 — forked from yanknudtskov/function-get-latlng-google-maps-api.php
How to get lat and lng from Google Maps API with curl #googlemaps
<?php
function yanco_get_lat_long( $address ){
$latlon_array = array();
$google_maps_key = 'XXXXXXXXXX'; // Remember to have a valid API key
$region = 'DK';
$url = 'https://maps.google.com/maps/api/geocode/json?address=' . $address . '&sensor=false&region=' . $region . '&key=' . $google_maps_key;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
@INDIAN2020
INDIAN2020 / autocomplete.php
Created June 18, 2018 06:15 — forked from yanknudtskov/autocomplete.php
Adding Extra Attributes for Algolia #algolia #woocommerce
<?php
/*
* Place this file in /wp-content/theme-directory/algolia/
* to override algolias autocomplete for searches
*/
?>
<script type="text/html" id="tmpl-autocomplete-header">
@INDIAN2020
INDIAN2020 / gravatar-prefetch.php
Created June 18, 2018 06:14 — forked from yanknudtskov/gravatar-prefetch.php
Gravatar Prefetch Example
<?php
/*
* Adding DNS Prefetching
*/
function dns_prefetch() {
echo '<meta http-equiv="x-dns-prefetch-control" content="on">
<link rel="dns-prefetch" href="//fonts.googleapis.com" />
<link rel="dns-prefetch" href="//fonts.gstatic.com" />
<link rel="dns-prefetch" href="//0.gravatar.com/" />
@INDIAN2020
INDIAN2020 / wp-reset-password-emails.php
Created June 18, 2018 06:13 — forked from yanknudtskov/wp-reset-password-emails.php
WordPress Password Reset mails filter, because gmail sometimes removes the link, this fixes it. #passwordreset #wpmail
<?php
add_filter('retrieve_password_message', 'yanco_custom_password_reset', 99, 4);
function yanco_custom_password_reset($message, $key, $user_login, $user_data ) {
$message = __('Someone has requested a password reset for the following account:') . "<br><br>";
$message .= network_home_url( '/' ) . "<br><br>";
$message .= sprintf(__('%s'), $user_data->user_email) . "<br><br>";
$message .= __('If this was a mistake, just ignore this email and nothing will happen.') . "<br><br>";
$message .= __('To reset your password use the link below:') . "<br><br>";
@INDIAN2020
INDIAN2020 / wc-remove-zoom-galleries.php
Created June 18, 2018 06:11 — forked from yanknudtskov/wc-remove-zoom-galleries.php
Remove Zoom from WooCommerce Galleries
<?php
/*
* Remove Zoom from WooCommerce Galleries
*/
add_action( 'after_setup_theme', 'yanco_after_setup_theme', 100 );
function yanco_after_setup_theme() {
remove_theme_support( 'wc-product-gallery-zoom' );
}