Skip to content

Instantly share code, notes, and snippets.

View joedolson's full-sized avatar

Joe Dolson joedolson

View GitHub Profile
@joedolson
joedolson / ID24 Demo 4
Created May 23, 2015 17:00
Set up some basic HTML around these URLs, so that we have some standard links we'll use.
/*
* Generate the HTML links using URLs.
*
* @param integer $post_ID of current post
*
* @return string block of HTML links.
*/
function id24_create_links( $post_ID ) {
$urls = id24_create_urls( $post_ID );
$html = '';
@joedolson
joedolson / ID24 Demo 3
Created May 23, 2015 17:00
Using that data, we format the URLs. Data gets urlencoded so the URLs will be valid.
/*
* Generate the URLs used to post data to services.
*
* @param integer $post_ID of current post
*
* @return array of URLs for posting to each service.
*/
function id24_create_urls( $post_ID ) {
$data = id24_post_information( $post_ID );
$twitter = "https://twitter.com/intent/tweet?text=" . urlencode( $data['title'] . ' ' . $data['url'] );
@joedolson
joedolson / ID24 Demo 2
Created May 23, 2015 16:59
We need to acquire some basic data that will be useful in Social Sharing URLs. Title, URL, image data.
/*
* Get the post data that will be sent to social sharing pages.
*
* @param integer $post_ID ID of the current post.
*
* @return array of post data.
*/
function id24_post_information( $post_ID ) {
$data = array();
$data['title'] = get_the_title( $post_ID );
@joedolson
joedolson / ID24 Demo 1
Created May 23, 2015 16:59
This is the essentials for creating any WordPress plug-in: Informational comment block and internationalization.
<?php
/*
* Plugin Name: ID24 Social Sharing
* Plugin URI:
* Plugin Description: Demo plug-in for #ID24 and #GAAD
* Version: 1.0
* Author: Joe Dolson
* Author URI: http://www.joedolson.com
*/
<button class='menu-toggle' aria-controls='menu-main-menu' aria-expanded='false'>
<span class="dashicons dashicons-menu" aria-hidden="true"></span>
<span class='screen-reader-text'><?php _e( 'Expand Menu','textdomain' ); ?></span>
</button>