Skip to content

Instantly share code, notes, and snippets.

View roose's full-sized avatar
🐢
Looking for a job

roose roose

🐢
Looking for a job
View GitHub Profile
@mjc
mjc / DD32s-combine-plugin.php
Created December 5, 2008 04:38
WIP: Combine Javascript and CSS in wordpress
<?php
/*
Plugin Name: The Combiner
Plugin URI: http://dd32.id.au/wordpress-plugins/?plugin=combine-css-js
Description: Combine CSS & JS into one large monolithic file
Author: DD32
Version: 1.0
Author URI: http://dd32.id.au/
*/
@felipelavinz
felipelavinz / get_by_name.php
Created November 24, 2009 18:24
Get stuff by name (WordPress)
<?php
/**
* Get stuff ID by nicename
* @param $nicename string The nicename (i.e: post-slug) to get the ID for
* @param $type string The table that will be queried: posts (default), term, users
* @return integer The ID for the requested object, false if nothing found
*/
function get_by_name($nicename, $type="posts"){
global $wpdb;
if ( empty($type) OR $type === 'post'){
@seedprod
seedprod / gist:272610
Created January 9, 2010 00:34
WordPress Loop Shortcode
// The Loop
/*
* Usage: loop category="news" query="" pagination="false"
*/
<?php
add_shortcode("loop", "myLoop");
function myLoop($atts, $content = null) {
extract(shortcode_atts(array(
@elg0nz
elg0nz / Rss.php
Created February 1, 2010 01:49
Rss Fetching with wordpress' fetch_feed
<?php include_once(ABSPATH . WPINC . '/rss.php');
$rss = fetch_feed('http://twitter.com/statuses/user_timeline/13436616.rss');
$maxitems = $rss->get_item_quantity(3);
$rss_items = $rss->get_items(0, $maxitems);
?>
<ul>
<?php if ($maxitems == 0) echo '<li>No items.</li>';
else
// Loop through each feed item and display each item as a hyperlink.
foreach ( $rss_items as $item ) : ?>
@artlung
artlung / README.md
Last active February 26, 2018 10:28
WordPress Graphical Post Count Visualization
@seedprod
seedprod / wp-blog-defaults.php
Created April 18, 2010 19:01
WP Blog Defaults
<?php
/******************************************************************************************************************
Plugin Name: cets_blog_defaults
Plugin URI:
Description: WordPressMU plugin for site admin to set defaults for new blogs.
Version: 1.2.3
@livingston
livingston / getLocation.html
Created April 28, 2010 12:40
HTML5 Geolocation with Fallback to Google Ajax API
<!-- HTML5 Geolocation with Fallback to Google Ajax API
-- http://marcgrabanski.com/article/html5-geolocation-fallback-google-ajax-api
-->
<script src="http://www.google.com/jsapi?key=YOUR_API_KEY" type='text/javascript'></script>
<script type='text/javascript'>
var myLocation; // global variable to store lat/lng
if (navigator && navigator.geolocation) {
// HTML5 GeoLocation
function getLocation(position) {
@livingston
livingston / gist:383512
Created April 29, 2010 12:14
Cleanup Wordpress Header & use Google Hosted jQuery
<?php
/* Cleanup Wordpress Header & use Google Hosted jQuery */
function cleanUp() {
function restatement_scripts_unversion($src) {
if( strpos($src,'ajax.googleapis.com') )
$src=remove_query_arg('ver', $src);
return $src;
}
@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(); } ?>
@thefuxia
thefuxia / Wordpress-feed-desc-fulltext.php
Created July 22, 2010 10:18
Print full text in feed description
<?php
add_filter('the_excerpt_rss', 'my_fulltext_desc');
function my_fulltext_desc($excerpt)
{
if ( ! is_feed() )
{
return $excerpt;
}
return apply_filters('the_content', get_the_content() );