Skip to content

Instantly share code, notes, and snippets.

View coder618's full-sized avatar
🎯
Focusing

Ahadul Islam coder618

🎯
Focusing
View GitHub Profile
@grexlort
grexlort / phonePrefixCodesWithCountry.php
Last active April 3, 2024 07:15
List of phone prefix codes with country in PHP array format prefix => country +xxx
// data from https://gist.github.com/andyj/7108917
$array = [
'44' => 'UK (+44)',
'1' => 'USA (+1)',
'213' => 'Algeria (+213)',
'376' => 'Andorra (+376)',
'244' => 'Angola (+244)',
'1264' => 'Anguilla (+1264)',
'1268' => 'Antigua & Barbuda (+1268)',
@hissy
hissy / gist:7352933
Created November 7, 2013 11:07
[WordPress] Add file to media library programmatically
<?php
$file = '/path/to/file.png';
$filename = basename($file);
$upload_file = wp_upload_bits($filename, null, file_get_contents($file));
if (!$upload_file['error']) {
$wp_filetype = wp_check_filetype($filename, null );
$attachment = array(
'post_mime_type' => $wp_filetype['type'],
'post_parent' => $parent_post_id,
@dinolatoga
dinolatoga / gist:6004917
Last active January 21, 2021 07:34
Programmatically Create Pages/Posts in WordPress. Personally modified to work properly. Source: http://advent.squareonemd.co.uk/programmatically-create-a-wordpress-page-post-or-custom-post-type/
<?php
// Helper Functions
/**
* Programmatically creates a WordPress post based on the incoming parameters.
*
* Note: This function may need some additional work if you're dealing with non-English languages.
*
* @param string $title The title of the page as presented to the users
* @param string $slug The slug used to access the page via the URL
@dpetersen
dpetersen / product_grid.js
Created September 23, 2011 17:10
Product Grid JSON sample
{
"CO":[
{
"product-name":"MEN'S BETTER THAN NAKED&trade; JACKET",
"product-image-url":"http://images.thenorthface.com/is/image/TheNorthFace/236x204_CLR/mens-better-than-naked-jacket-AVMH_LC9_hero.png",
"header-top-right-text":"Shop All",
"header-top-left-text":"Men's",
"product-url":"http://www.thenorthface.com/catalog/sc-gear/men-39-s-better-than-naked-8482-jacket.html",
"header-top-right-url":"http://www.thenorthface.com/en_US/shop-mens/",
"product-cta-text":"Shop Now"