Skip to content

Instantly share code, notes, and snippets.

View mayeenulislam's full-sized avatar
🤖
AI won't replace you

Mayeenul Islam mayeenulislam

🤖
AI won't replace you
View GitHub Profile
@mayeenulislam
mayeenulislam / cURL practice
Last active August 29, 2015 14:01
Grabbing a complete website usig cURL
<?php
/* Assisted by Mr. Ariful Haque */
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, 'http://www.oilprice.com');
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true);
$content = curl_exec($ch);
@mayeenulislam
mayeenulislam / WP: Force sub-categories to use the parent category template
Created May 29, 2014 06:34
WordPress: Force sub-categories to use the parent category template - werdswords.com
function new_subcategory_hierarchy() {
$category = get_queried_object();
$parent_id = $category->category_parent;
$templates = array();
if ( $parent_id == 0 ) {
// Use default values from get_category_template()
$templates[] = "category-{$category->slug}.php";
@mayeenulislam
mayeenulislam / Colorful grids
Last active August 29, 2015 14:03
Colorful grids
<script type="text/javascript">
/**
* Source: http://stackoverflow.com/a/10540361
* Thanks to: dknaack
*
* Loads custom color in each of the divs' background on each iteration
*/
function get_random_color() {
@mayeenulislam
mayeenulislam / Foreach Loop from Associative Array
Last active August 29, 2015 14:05
Foreach Loop from Associative Array
<?php
// A simple foreach() loop from an array
$age_array = array(
'0-18' => '0 - 18',
'19-25' => '19 - 25',
'26-30' => '26 - 30',
'31-50' => '31 - 50',
'51-65' => '51 - 65',
@mayeenulislam
mayeenulislam / WordPress Default Widget
Created November 20, 2014 05:37
Default WordPress widgets
<div id="secondary" class="widget-area">
<ul class="xoxo">
<?php if ( is_active_sidebar('primary_widget_area') ) : ?>
<?php dynamic_sidebar('primary_widget_area'); //load widgets from Admin Panel ?>
<?php else : ?>
<?php // Load the following widgets we are assigning here ?>
<li id="default-widget-1" class="widget-container default-widgets">
@mayeenulislam
mayeenulislam / jQuery - show or hide WP meta boxes on post type selection
Created December 24, 2014 04:59
jQuery - show/hide WP meta boxes on post type selection. To make things work, you have to assure the jQuery is turned on, and you have to enqueue the scripts using `admin_enqueue_scripts()`
jQuery(document).ready(function($) {
$('body.post-new-php #formatdiv input[id="post-format-gallery"], body.post-new-php #formatdiv input[id="post-format-video"]').change(function(){
$('.news-head-div').slideUp();
$('.news-highlight-div').slideUp();
$('#news-position').slideUp();
$('#categorydiv').slideUp();
});
$('body.post-new-php #formatdiv input[id="post-format-0"]').change(function(){

Keybase proof

I hereby claim:

  • I am mayeenulislam on github.
  • I am mayeenulislam (https://keybase.io/mayeenulislam) on keybase.
  • I have a public key whose fingerprint is CFF1 D104 6905 54AF 01CD 06CB EF58 8473 625B 520A

To claim this, I am signing this object:

* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@mayeenulislam
mayeenulislam / WordPress- alphabetical order search result
Created May 4, 2015 07:54
WordPress - ascending or alphabetical order search result
<?php
/**
* Ascending order search result - WordPress
* @param object $query
* @return void
*/
function wp20150504_alphabetical_search_query( $query ) {
//checking whether we are in the search result page or not
if ( $query->is_search && $query->is_main_query() ) {
@mayeenulislam
mayeenulislam / CSS_snapping.css
Created July 21, 2015 04:36
The following CSS will scroll overflowed items just like a slider
.item{
overflow: auto;
scroll-snap-type: proximity;
scroll-snap-points-x: repeat(300px);
}
/* Source: https://twitter.com/supersole/status/615924334675296256 */