Skip to content

Instantly share code, notes, and snippets.

View ihorvorotnov's full-sized avatar
🇺🇦
Working remotely since 1999

Ihor Vorotnov ihorvorotnov

🇺🇦
Working remotely since 1999
View GitHub Profile

NOTE I'm trying to find the most optimal fav/touch icon setup for my use-cases. Nothing new here. Read Mathias Bynens' articles on re-shortcut-icon and touch icons, a FAQ or a Cheat Sheet for all the details.

I'd like to hear how you approach this: @valuedstandards or comment on this gist.

The issue

You have to include a boatload of link elements pointing to many different images to provide (mobile) devices with a 'favicon' or 'touch icon':

![Touch Icon Links](https://o.twimg.com/2/proxy.jpg?t=HBj6AWh0dHBzOi8vcGhvdG9zLTYuZHJvcGJveC5jb20vdC8yL0FBRGFGY1VRN1dfSExnT3cwR1VhUmtaUWRFcWhxSDVGRjNMdXFfbHRJWG1GNFEvMTIvMjI3OTE2L3BuZy8xMDI0eDc2OC8yL18vMC80L1NjcmVlbnNob3QlMjAyMDE1LTA0LTE0JTIwMTYuNTYuMjYucG5nL0NNejBEU0FCSUFJZ0F5Z0JLQUkvNGR1eDZnMzZmYnlzYWI3

@danielbachhuber
danielbachhuber / Show author metadata if available
Created May 16, 2010 03:58
Shows WordPress author metadata if available
<?php $author = get_post_meta($post->ID, 'author', true);
if ($author) { echo $author; } else { the_author(); } ?>
@rmccue
rmccue / gist:507168
Created August 3, 2010 21:13
(WordPress) Get posts filtered by meta key
<?php
$posts = get_posts( 'post_type=any&meta_key=producer&meta_value=' . $producer_id );
<?php
/*
* Example code showing how to hook WordPress to add several fields to the taxonomny term edit screen.
* To-Do: Add field types other than text fields.
*
* Original author:
*
* Mike Schinkel (http://mikeschinkel.com/custom-wordpress-plugins/)
*
* NOTE:
@danielbachhuber
danielbachhuber / gist:1117115
Created July 31, 2011 19:31
Set WordPress user display name
<?php
require_once('./wp-load.php');
$all_users = get_users();
foreach( $all_users as $user ) {
if ( $user->user_login == $user->display_name ) {
$user_info = get_userdata( $user->ID );
$new_display_name = $user_info->first_name . ' ' . $user_info->last_name;
@danielbachhuber
danielbachhuber / gist:1409229
Created November 30, 2011 14:23
Handling WordPress search
<?php
/**
* Give the user a 404 if they do an internal WP search
*/
function db_unresolve_search() {
global $wp_query;
if ( $wp_query->is_search )
$wp_query->is_404 = true;
}
add_action( 'template_redirect', 'db_unresolve_search' );
@sorich87
sorich87 / .gitignore
Created December 13, 2011 17:06 — forked from redoPop/.gitignore
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@mboynes
mboynes / sitemap-builder.php
Created February 9, 2012 00:05
Google XML Sitemaps Generator for WordPress 4.0beta8 Custom Post Type Fix
<?php
/*
$Id: sitemap-builder.php 420059 2011-08-06 14:31:30Z arnee $
*/
/**
* Default sitemap builder
*
* @author Arne Brachhold
<?php
add_action('publish_post', 'schedule_glossary_index', 10, 1);
function schedule_glossary_index($post_id) {
wp_schedule_single_event(time(), 'update_glossary_index', array( $post_id ));
}
add_action('update_glossary_index', 'do_update_glossary_index', 10, 1);
function do_update_glossary_index($post_id) {
global $wpdb;
global $wpdb;
$rows = $wpdb->get_results( $wpdb->prepare( "SELECT blog_id FROM wp_blogs where blog_id > 1" ) );
foreach( $rows as $row ) {
print_r( "siteid ".$row->blog_id );
}