Returning just Li element in WordPress Menus
By default WordPress new menu scheme, creates markup which looks like this:
<div>
<ul>
<li><a href="#">List Item 1</li>
</ul>
</div>
Which is fine, but if you want to style it or append items to existing list can be a pain, in such cases you can remove the two containers:
<?php wp_nav_menu( array( 'theme_location' => 'main-nav', 'container', 'items_wrap' => '%3$s') ); ?>
now it will just generate:
<li><a href="#">List Item 1</li>
much better :)
Pro Tip: Filesystemiterator
PHP’s Filesystemiterator class is PHP5.3+
http://www.php.net/manual/en/class.filesystemiterator.php
http://bugs.php.net/bug.php?id=53859
They forgot to put a PHP minimum version on the docs…..
Remove all the gunk from the Wordpress header
remove_action(‘wp_head’, ‘wp_generator’);
remove_action(‘wp_head’, ‘index_rel_link’);
remove_action(‘wp_head’, ‘parent_post_rel_link’, 10, 0);
remove_action(‘wp_head’, ‘start_post_rel_link’, 10, 0);
remove_action(‘wp_head’, ‘adjacent_posts_rel_link’, 10, 0);
remove_action(‘wp_head’, ‘wlwmanifest_link’);
remove_action(‘wp_head’, ‘rsd_link’);
remove_action(‘wp_head’, ‘rel_canonical’);
Full Country ISO Code List
$countries = array(
”af” => “Afghanistan”,
”ax” => “Aland Islands”,
”al” => “Albania”,
”dz” => “Algeria”,
”as” => “American Samoa”,
”ad” => “Andorra”,
”ao” => “Angola”,
”ai” => “Anguilla”,
”aq” => “Antarctica”,
”ag” => “Antigua and Barbuda”,
”ar” => “Argentina”,
”am” => “Armenia”,
”aw” => “Aruba”,
”au” => “Australia”,
”at” => “Austria”,
”az” => “Azerbaijan”,
”bs” => “Bahamas”,
”bh” => “Bahrain”,
”bd” => “Bangladesh”,
”bb” => “Barbados”,
”by” => “Belarus”,
”be” => “Belgium”,
”bz” => “Belize”,
”bj” => “Benin”,
”bm” => “Bermuda”,
”bt” => “Bhutan”,
”bo” => “Bolivia”,
”ba” => “Bosnia and Herzegovina”,
”bw” => “Botswana”,
”bv” => “Bouvet Island”,
”br” => “Brazil”,
”io” => “British Indian Ocean Territory”,
”vg” => “British Virgin Islands”,
”bn” => “Brunei”,
”bg” => “Bulgaria”,
”bf” => “Burkina Faso”,
”bi” => “Burundi”,
”kh” => “Cambodia”,
”cm” => “Cameroon”,
”ca” => “Canada”,
”cv” => “Cape Verde”,
”ky” => “Cayman Islands”,
”cf” => “Central African Republic”,
”td” => “Chad”,
”cl” => “Chile”,
”cn” => “China”,
”cx” => “Christmas Island”,
”cc” => “Cocos (Keeling) Islands”,
”co” => “Colombia”,
”km” => “Comoros”,
”cg” => “Congo (Brazzaville)”,
”cd” => “Congo (Kinshasa)”,
”ck” => “Cook Islands”,
”cr” => “Costa Rica”,
”hr” => “Croatia”,
”cu” => “Cuba”,
”cy” => “Cyprus”,
”cz” => “Czech Republic”,
”dk” => “Denmark”,
”dj” => “Djibouti”,
”dm” => “Dominica”,
”do” => “Dominican Republic”,
”tl” => “East Timor”,
”ec” => “Ecuador”,
”eg” => “Egypt”,
”sv” => “El Salvador”,
”gq” => “Equatorial Guinea”,
”er” => “Eritrea”,
”ee” => “Estonia”,
”et” => “Ethiopia”,
”fk” => “Falkland Islands”,
”fo” => “Faroe Islands”,
”fj” => “Fiji”,
”fi” => “Finland”,
”fr” => “France”,
”gf” => “French Guiana”,
”pf” => “French Polynesia”,
”tf” => “French Southern Territories”,
”ga” => “Gabon”,
”gm” => “Gambia”,
”ge” => “Georgia”,
”de” => “Germany”,
”gh” => “Ghana”,
”gi” => “Gibraltar”,
”gr” => “Greece”,
”gl” => “Greenland”,
”gd” => “Grenada”,
”gp” => “Guadeloupe”,
”gu” => “Guam”,
”gt” => “Guatemala”,
”gg” => “Guernsey”,
”gn” => “Guinea”,
”gw” => “Guinea-Bissau”,
”gy” => “Guyana”,
”ht” => “Haiti”,
”hm” => “Heard Island and McDonald Islands”,
”hn” => “Honduras”,
”hk” => “Hong Kong S.A.R., China”,
”hu” => “Hungary”,
”is” => “Iceland”,
”in” => “India”,
”id” => “Indonesia”,
”ir” => “Iran”,
”iq” => “Iraq”,
”ie” => “Ireland”,
”im” => “Isle of Man”,
”il” => “Israel”,
”it” => “Italy”,
”ci” => “Ivory Coast”,
”jm” => “Jamaica”,
”jp” => “Japan”,
”je” => “Jersey”,
”jo” => “Jordan”,
”kz” => “Kazakhstan”,
”ke” => “Kenya”,
”ki” => “Kiribati”,
”kw” => “Kuwait”,
”kg” => “Kyrgyzstan”,
”la” => “Laos”,
”lv” => “Latvia”,
”lb” => “Lebanon”,
”ls” => “Lesotho”,
”lr” => “Liberia”,
”ly” => “Libya”,
”li” => “Liechtenstein”,
”lt” => “Lithuania”,
”lu” => “Luxembourg”,
”mo” => “Macao S.A.R., China”,
”mk” => “Macedonia”,
”mg” => “Madagascar”,
”mw” => “Malawi”,
”my” => “Malaysia”,
”mv” => “Maldives”,
”ml” => “Mali”,
”mt” => “Malta”,
”mh” => “Marshall Islands”,
”mq” => “Martinique”,
”mr” => “Mauritania”,
”mu” => “Mauritius”,
”yt” => “Mayotte”,
”mx” => “Mexico”,
”fm” => “Micronesia”,
”md” => “Moldova”,
”mc” => “Monaco”,
”mn” => “Mongolia”,
”me” => “Montenegro”,
”ms” => “Montserrat”,
”ma” => “Morocco”,
”mz” => “Mozambique”,
”mm” => “Myanmar”,
”na” => “Namibia”,
”nr” => “Nauru”,
”np” => “Nepal”,
”nl” => “Netherlands”,
”an” => “Netherlands Antilles”,
”nc” => “New Caledonia”,
”nz” => “New Zealand”,
”ni” => “Nicaragua”,
”ne” => “Niger”,
”ng” => “Nigeria”,
”nu” => “Niue”,
”nf” => “Norfolk Island”,
”mp” => “Northern Mariana Islands”,
”kp” => “North Korea”,
”no” => “Norway”,
”om” => “Oman”,
”pk” => “Pakistan”,
”pw” => “Palau”,
”ps” => “Palestinian Territory”,
”pa” => “Panama”,
”pg” => “Papua New Guinea”,
”py” => “Paraguay”,
”pe” => “Peru”,
”ph” => “Philippines”,
”pn” => “Pitcairn”,
”pl” => “Poland”,
”pt” => “Portugal”,
”pr” => “Puerto Rico”,
”qa” => “Qatar”,
”re” => “Reunion”,
”ro” => “Romania”,
”ru” => “Russia”,
”rw” => “Rwanda”,
”sh” => “Saint Helena”,
”kn” => “Saint Kitts and Nevis”,
”lc” => “Saint Lucia”,
”pm” => “Saint Pierre and Miquelon”,
”vc” => “Saint Vincent and the Grenadines”,
”ws” => “Samoa”,
”sm” => “San Marino”,
”st” => “Sao Tome and Principe”,
”sa” => “Saudi Arabia”,
”sn” => “Senegal”,
”rs” => “Serbia”,
”cs” => “Serbia And Montenegro”,
”sc” => “Seychelles”,
”sl” => “Sierra Leone”,
”sg” => “Singapore”,
”sk” => “Slovakia”,
”si” => “Slovenia”,
”sb” => “Solomon Islands”,
”so” => “Somalia”,
”za” => “South Africa”,
”gs” => “South Georgia and the South Sandwich Islands”,
”kr” => “South Korea”,
”es” => “Spain”,
”lk” => “Sri Lanka”,
”sd” => “Sudan”,
”sr” => “Suriname”,
”sj” => “Svalbard and Jan Mayen”,
”sz” => “Swaziland”,
”se” => “Sweden”,
”ch” => “Switzerland”,
”sy” => “Syria”,
”tw” => “Taiwan”,
”tj” => “Tajikistan”,
”tz” => “Tanzania”,
”th” => “Thailand”,
”tg” => “Togo”,
”tk” => “Tokelau”,
”to” => “Tonga”,
”tt” => “Trinidad and Tobago”,
”tn” => “Tunisia”,
”tr” => “Turkey”,
”tm” => “Turkmenistan”,
”tc” => “Turks and Caicos Islands”,
”tv” => “Tuvalu”,
”vi” => “U.S. Virgin Islands”,
”ug” => “Uganda”,
”ua” => “Ukraine”,
”ae” => “United Arab Emirates”,
”uk” => “United Kingdom”,
”us” => “United States”,
”um” => “United States Minor Outlying Islands”,
”uy” => “Uruguay”,
”uz” => “Uzbekistan”,
”vu” => “Vanuatu”,
”va” => “Vatican”,
”ve” => “Venezuela”,
”vn” => “Vietnam”,
”wf” => “Wallis and Futuna”,
”eh” => “Western Sahara”,
”ye” => “Yemen”,
”zm” => “Zambia”,
”zw” => “Zimbabwe”
);
Paypal Currency ISO Class
Simple class to help get the currency symbol when passing a standard ISO code.
<?php
class Currencies {
public $currencies = array(
’AUD’ => array(‘name’ => “Australian Dollar”, ‘symbol’ => “A$”, ‘ASCII’ => “A$”),
’CAD’ => array(‘name’ => “Canadian Dollar”, ‘symbol’ => “$”, ‘ASCII’ => “$”),
’CZK’ => array(‘name’ => “Czech Koruna”, ‘symbol’ => “Kč”, ‘ASCII’ => “”),
’DKK’ => array(‘name’ => “Danish Krone”, ‘symbol’ => “Kr”, ‘ASCII’ => “”),
’EUR’ => array(‘name’ => “Euro”, ‘symbol’ => “€”, ‘ASCII’ => “€”),
’HKD’ => array(‘name’ => “Hong Kong Dollar”, ‘symbol’ => “$”, ‘ASCII’ => “$”),
’HUF’ => array(‘name’ => “Hungarian Forint”, ‘symbol’ => “Ft”, ‘ASCII’ => “”),
’ILS’ => array(‘name’ => “Israeli New Sheqel”, ‘symbol’ => “₪”, ‘ASCII’ => “₩”),
’JPY’ => array(‘name’ => “Japanese Yen”, ‘symbol’ => “¥”, ‘ASCII’ => “¥”),
’MXN’ => array(‘name’ => “Mexican Peso”, ‘symbol’ => “$”, ‘ASCII’ => “$”),
’NOK’ => array(‘name’ => “Norwegian Krone”, ‘symbol’ => “Kr”, ‘ASCII’ => “”),
’NZD’ => array(‘name’ => “New Zealand Dollar”, ‘symbol’ => “$”, ‘ASCII’ => “$”),
’PHP’ => array(‘name’ => “Philippine Peso”, ‘symbol’ => “₱”, ‘ASCII’ => “”),
’PLN’ => array(‘name’ => “Polish Zloty”, ‘symbol’ => “zł”, ‘ASCII’ => “”),
’GBP’ => array(‘name’ => “Pound Sterling”, ‘symbol’ => “£”, ‘ASCII’ => “£”),
’SGD’ => array(‘name’ => “Singapore Dollar”, ‘symbol’ => “$”, ‘ASCII’ => “$”),
’SEK’ => array(‘name’ => “Swedish Krona”, ‘symbol’ => “kr”, ‘ASCII’ => “”),
’CHF’ => array(‘name’ => “Swiss Franc”, ‘symbol’ => “CHF”, ‘ASCII’ => “”),
’TWD’ => array(‘name’ => “Taiwan New Dollar”, ‘symbol’ => “NT$”, ‘ASCII’ => “NT$”),
’THB’ => array(‘name’ => “Thai Baht”, ‘symbol’ => “฿”, ‘ASCII’ => “฿”),
’USD’ => array(‘name’ => “U.S. Dollar”, ‘symbol’ => “$”, ‘ASCII’ => “$”)
);
public function getSymbol($code = ‘USD’) {
if (!empty($this->currencies[$code][‘ASCII’])) {
return (string) $this->currencies[$code][‘ASCII’];
}
return (string) $this->currencies[$code][‘symbol’];
}
}
?>