Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View pommiegranit's full-sized avatar

Chris Knowles pommiegranit

  • Melbourne, Australia
View GitHub Profile
@pommiegranit
pommiegranit / bosco_archive.php
Created August 15, 2014 02:41
WordPress theme changes when adding category featured images
<?php
/**
* @package Bosco
*/
if ( is_category() && function_exists('category_image_src')) {
$category_image = category_image_src( array( 'size' => 'full' ) , false );
} else {
$category_image = '';
}
[caption id="attachment_1041" align="alignnone" width="690"]
<img src="http://www.test.dev/wp-content/uploads/2013/03/spider-man-690x1024.jpg"
alt="The Amazing Spider Man" width="690" height="1024" class="size-large wp-image-1041"
data-desc-style="map"/>
Click on the spider icon to learn more about The Amazing Spider Man[/caption]
<header id="masthead" class="site-header" role="banner">
<div class="site-branding">
<h1 class="site-title"><a href="http://www.test.dev/" rel="home">My Sticky Menu</a></h1>
<h2 class="site-description">And I Don't Even Live In New York. Yet.</h2>
</div>
<nav id="site-navigation" class="main-navigation" role="navigation">
<h1 class="menu-toggle">Menu</h1>
<a class="skip-link screen-reader-text" href="#content">Skip to content</a>
<div class="menu-mobile-main-container">
<ul id="menu-mobile-main" class="menu">
@pommiegranit
pommiegranit / base.twig
Last active May 31, 2021 18:50
Timber + Twig Examples
{% import 'twig/macros.twig' as macros %}
{{ function( 'get_header' ) }}
<div id="primary" class="content-area">
<div id="main" class="site-main" role="main">
{% block content %}{% endblock %}
</div><!-- #main -->
@pommiegranit
pommiegranit / semantic.php
Created June 30, 2014 06:54
Switch on semantic markup options for images in WordPress
<?php
/*
Plugin Name: Semantic
Plugin URI: http://premium.wpmudev.org/blog
Description: Activate Semantic Markup options
Author: Chris Knowles
Version: 1.0
Author URI: http://twitter.com/ChrisKnowles
*/
@pommiegranit
pommiegranit / check_close_comments.php
Created June 13, 2014 02:57
Applies the 'close comments after x days' to all WordPress post types
<?php
/*
Plugin Name: Link PDF Attachment
Plugin URI: http://premium.wpmudev.org
Description: Adds a link to the top of a WordPress post to the first PDF attachment
Author: Chris Knowles
Version: 1.0
Author URI: http://twitter.com/ChrisKnowles
*/
@pommiegranit
pommiegranit / link_pdf_attachment.php
Last active May 31, 2018 08:51
Simple plugin to add a link to the top of a WordPress post to any PDF attachment
<?php
/*
Plugin Name: Post Front Page
Plugin URI: http://premium.wpmudev.org
Description: Allows a post (not page) to become the front page of a WordPress site
Author: Chris Knowles
Version: 1.0
Author URI: http://twitter.com/ChrisKnowles
*/
@pommiegranit
pommiegranit / kml-default.php
Last active August 29, 2015 14:00
A WordPress plugin for building KML files from geocoded posts
<?php
// start of the KML Document
$kml = array('<?xml version="1.0" encoding="UTF-8"?>');
$kml[] = '<kml xmlns="http://www.opengis.net/kml/2.2">';
$kml[] = '<Document>';
$kml[] = '<name>' . $_REQUEST['post_type'] . ' KML export ' . '</name>';
// use query_string as input to WP_Query as this allows good control over the posts being selected - add posts_per_page to get all posts
$args = $_SERVER['QUERY_STRING'] . '&posts_per_page=-1';
@pommiegranit
pommiegranit / sincelastvisit.php
Last active August 29, 2015 13:58
Simple WP plugin to tag titles for posts published since visitor's last visit
<?php
/**
* Plugin Name: Since Last Visit
* Plugin URI: http://premium.wpmudev.org
* Description: Adds a "tag" to the title of posts published since visitor's last visit. Only works for initial page
* Version: 1.0
* Author: Chris Knowles
* Author URI: http://twitter.com/ChrisKnowles
* License: GPL2
*/