Skip to content

Instantly share code, notes, and snippets.

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

Joy Chetry joychetry

🏠
Working from home
View GitHub Profile
window.mobileCheck = function() {
let check = false;
(function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v
@erropix
erropix / oxy-cm-theme.scss
Created September 21, 2020 10:35
An Advanced Scripts snippet to enhance the Oxygen code editor theme
/*
Title: Oxygen Code Editor Theme
Type: CSS > Compile SCSS Code
Location: Custom Hooks
Hook name: oxygen_enqueue_ui_scripts
Priority: 10
*/
#oxygen-ui {
.cm-s-default {
@thetwopct
thetwopct / functions.php
Created February 8, 2020 12:33
Preload any footer JS files in the header
/**
* Preload any footer JS files in the header
*
* originally from: https://macarthur.me/posts/preloading-javascript-in-wordpress
*/
add_action('wp_head', function () {
global $wp_scripts;
@aslamdoctor
aslamdoctor / wp-ajax-loadmore.md
Last active November 22, 2023 00:41
Wordpress - AJAX Load More Steps

Step 1. Load more button

<?php
global $wp_query; // you can remove this line if everything works for you
 
// don't display the button if there are not enough posts
if (  $wp_query->max_num_pages > 1 )
	echo '<div class="misha_loadmore">More posts</div>'; // you can use <a> as well
?>
@GaryJones
GaryJones / functions.php
Created March 27, 2013 23:37
Insert ads or other content after specific paragraph in single post content. The second function here would be easily re-usable for inserting additional bits and pieces do whatever content under whatever conditions (e.g. Cinema tickets competition link after 3rd paragraph of Movie CPT).
<?php
add_filter( 'the_content', 'prefix_insert_post_ads' );
/**
* Insert code for ads after second paragraph of single post content.
*
* @param string $content Post content
*
* @return string Amended content
*/