Skip to content

Instantly share code, notes, and snippets.

View rolandinsh's full-sized avatar
🧔
Remote developer (LEMP, Node.js, Neo4j [graph])

Rolands rolandinsh

🧔
Remote developer (LEMP, Node.js, Neo4j [graph])
View GitHub Profile
@rolandinsh
rolandinsh / google-plus-feed.php
Created June 25, 2012 13:28 — forked from ocean90/google-plus-feed.php
WordPress Page Template to build a feed of your Google+ stream
<?php
/**
* Template Name: Google+ Feed
*/
/**
* A WordPress page template for a Google+ feed.
*
* @author Dominik Schilling
@rolandinsh
rolandinsh / fbcbfwss.php
Created June 30, 2012 02:46 — forked from ocean90/fbcbfwss.php
Filename-based cache busting for WordPress scripts/styles.
<?php
/**
* Filename-based cache busting for WordPress scripts/styles.
*
* Extend your .htaccess file with these lines:
*
* <IfModule mod_rewrite.c>
* RewriteEngine On
* RewriteBase /
*
@rolandinsh
rolandinsh / smc_is_login_page
Created July 11, 2012 09:09
WordPress is login or register page
<?php
/**
* Is login or register page
* @author umbrovskis
* @authorlink http://umbrovskis.com
*/
function smc_is_login_page() {
return in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'));
}
// hope some day WordPress will make is_login_page() or is_register_page() or similar
@rolandinsh
rolandinsh / endpoints.php
Created July 12, 2012 06:52 — forked from joncave/endpoints.php
WP_Rewrite endpoints demo
<?php
/*
Plugin Name: WP_Rewrite endpoints demo
Description: A plugin giving example usage of the WP_Rewrite endpoint API
Plugin URI: http://make.wordpress.org/plugins/2012/06/07/rewrite-endpoints-api/
Author: Jon Cave
Author URI: http://joncave.co.uk/
*/
function makeplugins_endpoints_add_endpoint() {
@rolandinsh
rolandinsh / gist:3097506
Created July 12, 2012 11:14
WordPress remove_action wp_head
/*
via wordpress.org/support/topic/remove-feed-from-wp_head?replies=7#post-1338292
for: http://simplemediacode.com/wordpress/
*/
remove_action( 'wp_head', 'feed_links_extra', 3 ); // Display the links to the extra feeds such as category feeds
remove_action( 'wp_head', 'feed_links', 2 ); // Display the links to the general feeds: Post and Comment Feed
remove_action( 'wp_head', 'rsd_link' ); // Display the link to the Really Simple Discovery service endpoint, EditURI link
remove_action( 'wp_head', 'wlwmanifest_link' ); // Display the link to the Windows Live Writer manifest file.
remove_action( 'wp_head', 'index_rel_link' ); // index link
remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 ); // prev link
@rolandinsh
rolandinsh / gist:3177639
Last active October 7, 2015 14:18
HTML5 MB
<!doctype html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta charset="utf-8">
<link rel="dns-prefetch" href="//s2.me2j.com" /><link rel="dns-prefetch" href="//i2.me2j.com" />
<!--[if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /><![endif]-->
<title>Lapa</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<!--
All other head parts
-->
@rolandinsh
rolandinsh / itempropwp.php
Created July 26, 2012 14:04
itemprop wp
<?php
/*
info: http://simplemediacode.info/snippets/itemprop-attributes-for-wordpress-serp-results/
as WordPress plugin http://wordpress.org/extend/plugins/itempropwp/
*/
add_filter('post_thumbnail_html','mediaboxlv_image_itemprop',10,3 );
function mediaboxlv_image_itemprop($html, $post_id, $post_image_id){
$html = str_replace('src',' itemprop="image" src',$html);
return $html;
}
<?php
/*
Plugin Name: Test
*/
class My_Like_Button {
function __construct()
{
$this->hooks();
}
@rolandinsh
rolandinsh / gist:3259141
Created August 4, 2012 18:18
Bitbucket create/init and add remote
$ mkdir /path/to/your/project
$ cd /path/to/your/project
$ git init
$ git remote add origin https://USERNAME@bitbucket.org/USERNAME/project.git
Create a new repository on the command line
touch README.md
git init
@rolandinsh
rolandinsh / itempropwp_img_attr.php
Created August 4, 2012 18:20
add itemprop to WordPress elements (image attributes)
<?php
/*
* @author umbrovskis
* @url http://simplemediacode.info/?post_type=snippets&p=920
*/
add_filter('wp_get_attachment_image_attributes', 'ipwp_img_attr', 10, 2);
function ipwp_img_attr($attr) {
$attr['itemprop'] = 'image';
return $attr;
}