View gist:1217431
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// this would replace the rel_canonical function in wp-includes/link-template.php | |
/** | |
* Output rel=canonical | |
* | |
* @package WordPress | |
* @since 2.9.0 | |
*/ |
View index.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
get_header(); | |
query_posts('posts_per_page=4&cat=-46'); | |
if (have_posts()) : | |
$first = true; | |
View wordstream-api-class.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Class containing all the functionality to get data from the WordStream API | |
* | |
* @link http://api.wordstream.com/doc/introduction | |
* | |
* @author Joost de Valk <joost@yoast.com> | |
* @license http://opensource.org/licenses/gpl-license.php GNU Public License | |
* |
View gist:1347575
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function yoast_change_template( $template ) { | |
global $wp_query; | |
if ( !isset($wp_query->query_vars['taxonomy']) ) | |
return $template; | |
$taxonomy = get_taxonomy( $wp_query->query_vars['taxonomy'] ); | |
if ( is_search() && count( $taxonomy->object_type ) > 0 && !in_array( 'post', array_values($taxonomy->object_type) ) ) { | |
set_query_var('post_type', $taxonomy->object_type[0]); | |
$newtemplate = get_archive_template(); |
View gist:1500757
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add a search to filter the entires, the form_id is the form ID you see in the GET variable on the entries or edit page | |
$search = ""; | |
$form_id = 4; | |
// Authentication (add a username if you want for more security) | |
if ( ! isset($_GET['key']) || $_GET['key'] != '<set an API Key>' ) | |
die; |
View gist:1565059
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function yoast_oembed_dataparse( $html, $data, $url ) { | |
global $content_width; | |
preg_match( '/width="(\d+)"/', $html, $matches ); | |
$width = $matches[1]; | |
preg_match( '/height="(\d+)"/', $html, $matches ); | |
$height = $matches[1]; | |
$aspect_ratio = $width / $height; |
View gist:1918689
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | |
<script type="text/javascript"> | |
// Inspiration partly from: http://stackoverflow.com/questions/1897129 | |
jQuery(document).ready(function($) { | |
$('ul.dropdown').each(function(){ | |
var list = $(this); | |
var select = $(document.createElement('select')) | |
.attr('id',$(this).attr('id')) |
View links.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Template Name: Links | |
*/ | |
?> | |
<?php get_header(); ?> | |
<div id="content"> | |
<?php | |
if (have_posts()) : while (have_posts()) : the_post(); |
View pinterest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Usage [pin img="<url>" title="<title>"] | |
function yoast_pinterest_shortcode( $atts ) { | |
extract( shortcode_atts( array( | |
'url' => get_permalink(), | |
'img' => '', | |
'title' => get_the_title(), | |
'align' => 'alignright' |
View gist:2426489
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT c.Content, c.Title, c.ID, c.CTID, c.RID, r.Sitename, | |
CASE WHEN c.Title LIKE '%conversion%' THEN 1 ELSE 0 END AS titlematch, | |
CASE WHEN c.Content LIKE '%conversion%' THEN 1 ELSE 0 END AS contentmatch, | |
MATCH (c.Title, c.Content) AGAINST ('conversion') AS relevance | |
FROM Chapters c LEFT JOIN Reviews r | |
ON c.RID = r.ID | |
WHERE MATCH(c.Title, c.Content) AGAINST ('conversion' IN BOOLEAN MODE) | |
HAVING relevance > 0 | |
ORDER BY titlematch DESC, contentmatch DESC, relevance DESC | |
LIMIT 50 |
OlderNewer