Skip to content

Instantly share code, notes, and snippets.

View jsakhil's full-sized avatar
🎯
Focusing

Js Akhil jsakhil

🎯
Focusing
View GitHub Profile
var data = {
action: 'image_color',
id: 1234
}
//jQuery
jQuery.ajax(
{
url: " http://domain.com/wp-admin/admin-ajax.php",
type: "POST",
@jsakhil
jsakhil / hideelement.js
Created September 28, 2017 07:54
Trick to Hide Element in source code when debugger is opened
var currentInnerHtml;
var element = new Image();
var elementWithHiddenContent = document.querySelector("#elementtohide");
var innerHtml = elementWithHiddenContent.innerHTML;
element.__defineGetter__("id", function() {
currentInnerHtml = "";
});
@jsakhil
jsakhil / return-to-top.css
Created October 6, 2017 11:22
Simple Return to Top,
/* Return To Top */
#return-to-top {
position: fixed;
bottom: 20px;
right: 20px;
background: rgb(0, 0, 0);
background: rgba(0, 0, 0, 0.7);
width: 50px;
height: 50px;
@jsakhil
jsakhil / recaptcha.html
Created November 3, 2017 06:50
Multiple reCAPTCHA
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>
<div class="form-group">
<div class="g-recaptcha" id="optional-id"></div>
</div>
<script type="text/javascript" charset="utf-8">
var onloadCallback = function() {
var recaptchas = document.querySelectorAll('div[class=g-recaptcha]');
—– BEGIN LICENSE —–
TwitterInc
200 User License
EA7E-890007
1D77F72E 390CDD93 4DCBA022 FAF60790
61AA12C0 A37081C5 D0316412 4584D136
94D7F7D4 95BC8C1C 527DA828 560BB037
D1EDDD8C AE7B379F 50C9D69D B35179EF
2FE898C4 8E4277A8 555CE714 E1FB0E43
D5D52613 C3D12E98 BC49967F 7652EED2
@jsakhil
jsakhil / full_width.css
Created February 8, 2018 11:31
Equally distributed full width list item.
ul.full_width {
width: 100%;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-ms-flex-flow: row wrap;
flex-flow: row wrap;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
@jsakhil
jsakhil / lang_switch.html
Last active June 19, 2019 06:29
qTranslate WordPress Plugin Custom Language Switch
<div class="language_switch" tabindex="0">
<span class="current" data-value="en">EN</span>
<ul class="list">
<li data-value="en" class="option selected">EN</li>
<li data-value="fr" class="option">FR</li>
<li data-value="de" class="option">DE</li>
</ul>
</div>
@jsakhil
jsakhil / function.php
Last active June 19, 2019 06:31
WordPress Post Views Counter Without Any Plugin
<?php
function getPostViews($postID){
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
return "0 View";
}
return $count.' Views';
@jsakhil
jsakhil / pagination.js
Last active June 21, 2019 08:55
Full Width Pagination - An Auto expanding pagination with screen width - PyroCMS - ©Vishnu Soman US
var li_length = jQuery('ul.pagination li').length;
if(li_length == 13){
var li_item = jQuery('ul.pagination li:nth-child(9) a').attr('href');
var to_num_8 = jQuery('ul.pagination li:nth-child(11)').text();
$('<li><a href="'+li_item.replace("8", "9")+'">9</a></li>').insertAfter("ul.pagination li:nth-child(9)");
$('<li class="tenth"><a href="'+li_item.replace("8", "10")+'">10</a></li>').insertAfter("ul.pagination li:nth-child(10)");
var space = $('ul.pagination').parent().width() - $('ul.pagination').width();
@jsakhil
jsakhil / woo_commerce_usefull.php
Created June 29, 2019 06:10 — forked from vovadocent/woo_commerce_usefull.php
Woo Commerce Hooks and Tricks
<?php
////// Rename or remove order statuses //////
add_filter('wc_order_statuses', 'wc_renaming_order_status');
function wc_renaming_order_status($order_statuses) {
$order_statuses = array(
'wc-pending' => _x('Pending', 'Order status', 'woocommerce'),
'wc-processing' => _x('New Order', 'Order status', 'woocommerce'),
'wc-cancelled' => _x('Cancelled', 'Order status', 'woocommerce'),
'wc-completed' => _x('Approved', 'Order status', 'woocommerce'),