Skip to content

Instantly share code, notes, and snippets.

View sebastianpisula's full-sized avatar

Sebastian Pisula sebastianpisula

View GitHub Profile
@wpexplorer
wpexplorer / gist:8244555
Created January 3, 2014 19:19
Remove Slug From Custom Post Type URL
/**
* Remove the slug from published post permalinks. Only affect our CPT though.
*/
function wpex_remove_post_type_slug( $post_link, $post, $leavename ) {
if ( ! in_array( $post->post_type, array( 'YOUR_POST_TYPE' ) ) || 'publish' != $post->post_status )
return $post_link;
$post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );
@cubehouse
cubehouse / gist:3839159
Created October 5, 2012 10:34
WordPress Fake Page Generator - Use in Theme/Plugin to create non-existant pages dynamically
// create fake page called "chat-room"
// modify function and variable names with "ABCD" to whatever you like
// modify variable $fakepage_ABCD_url to the fake URL you require
add_filter('the_posts','fakepage_ABCD_detect',-10);
function fakepage_ABCD_detect($posts){
global $wp;
global $wp_query;
global $fakepage_ABCD_detect; // used to stop double loading