Skip to content

Instantly share code, notes, and snippets.

@caercam
caercam / list-table-example.php
Created April 2, 2014 14:06
Custom List Table Example WordPress plugin fork implementing AJAX loading
<?php
/*
Plugin Name: Custom List Table Example
Plugin URI: http://www.mattvanandel.com/
Description: A highly documented plugin that demonstrates how to create custom List Tables using official WordPress APIs.
Version: 1.3
Author: Matt Van Andel
Author URI: http://www.mattvanandel.com
License: GPL2
*/
@caercam
caercam / single.php
Created July 21, 2014 15:16
single.php from WordPress Ming 1.0.4 theme: add post thumbnail
<?php
/**
* @since ming 1.0.0
**/
get_header(); ?>
<div id="content">
<div class="container">
<div id="main">
<div id="breadcrumb" itemprop="breadcrumb"><a href="<?php echo esc_url( home_url() ); ?>" rel="nofollow"><?php _e( 'Home', 'ming' ); ?></a> / <?php the_category(' | ') ?>
/**
* Show some info about movies in post view.
*
* Add a filter on the_content hook to display infos selected in options
* about the movie: year, director, actors...
*
* @since 1.0.0
*
* @param string $content The original post content
@caercam
caercam / relatedposts.php
Created August 13, 2014 09:04
relatedposts.php from WordPress moviestar theme: add movies support
<?php
/**
* WPMovieLibrary Utils Class extension.
*
* This class contains various tools needed by WPML such as array manipulating
* filters, terms ordering methods or permalinks creation.
*
* @package WPMovieLibrary
* @author Charlie MERLAND <charlie@caercam.org>
* @license GPL-3.0
function wpmoly_suffix( $post_link, $post, $leavename, $sample ) {
if ( 'movie' != get_post_type( $post ) )
return $post_link;
$post_link = str_replace( $post->post_name, $post->post_name . '-value', $post_link );
return $post_link;
}
add_filter( 'post_type_link', 'wpmoly_suffix', 10, 4 );
@caercam
caercam / functions.php
Last active June 22, 2016 14:30
Add the movie's release date to movie title display
<?php
/**
* Add release date to a movie's title
*
* Add this at then end of your theme's functions.php file
*
* @deprecated since WordPress 4.4
*
* @param string Current, unfiltered movie title
@caercam
caercam / update_movies.php
Last active August 29, 2015 14:07
Update all movie titles to include movie date.
<?php
/**
* Update all movie titles to include movie date.
*
* @package WordPress
*/
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
$query = new WP_Query(
@caercam
caercam / fix_movies.php
Last active August 29, 2015 14:07
Restore all movie titles including movie date to simple movie title.
<?php
/**
* Restore all movie titles including movie date to simple movie title.
*
* @package WordPress
*/
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
$query = new WP_Query(
@caercam
caercam / gist:fee98c7eb6c823daabd1
Created November 6, 2014 07:40
Remove WPMOLY 2.0 Headbox tabs. Place this at the end of your theme's functions.php file.
function wpmoly_remove_headbox_tabs( $tabs ) {
unset( $tabs['meta'], $tabs['details'] );
return $tabs;
}
add_filter( 'wpmoly_filter_headbox_menu_link', 'wpmoly_remove_headbox_tabs', 10, 1 );
add_filter( 'wpmoly_filter_headbox_menu_tabs', 'wpmoly_remove_headbox_tabs', 10, 1 );