Skip to content

Instantly share code, notes, and snippets.

@icetee
icetee / wp_ext_pll_functions.php
Last active March 20, 2023 12:54
Polylang function_exists (active the plugin) - WordPress - Paste the code into functions.php
/*
* Polylang Language API functions tester - WordPress
* Github: https://gist.github.com/icetee/fbbfef5534fead58611e
*
*/
function ex_pll_the_languages($arg = '') {
if ( function_exists('pll_the_languages') ) {
return pll_the_languages($arg);
}
@isotrope
isotrope / example-menu-item.css
Last active March 22, 2022 06:42
Add (a) Polylang switcher menu item(s) to any menu.
/*
Example CSS of how I was showing one OR the other, based on brwoser-width
*/
@media (max-width: @grid-float-breakpoint-max) {
.language-code {
display: none;
}
}
@gherkins
gherkins / image_xml_sitemap.php
Created October 20, 2012 17:04
Create Google (Image) XML Sitemaps using PHP
header("Content-type: text/xml; charset=utf-8");
//create your XML document, using the namespaces
$urlset = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" /><!--?xml version="1.0" encoding="UTF-8"?-->');
//iterate over your sites pages or whatever you like
foreach (getMyPagesOrWhatEver() as $item):
//add the page URL to the XML urlset
@leoken
leoken / wp-bootstrap-footer-nav.php
Created October 13, 2012 06:01
For creating a footer nav in WordPress using the bootstrap scaffolding
@gyrus
gyrus / preload-images.js
Last active March 3, 2021 11:57
WordPress image preloading
/**
* Image preloader
*
* @link http://engineeredweb.com/blog/09/12/preloading-images-jquery-and-javascript
*/
var cache = [];
// Arguments are image paths relative to the current page.
function pilau_preload_images() {
var args_len, i, cache_image;
args_len = arguments.length;