Skip to content

Instantly share code, notes, and snippets.

@jordipiella
jordipiella / gist:7198fec980a9f3dda68765d9c4818da2
Created May 27, 2019 19:48 — forked from cubehouse/gist:3839159
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
@jordipiella
jordipiella / functions.php
Created May 27, 2019 19:42
Creating virtual pages on Wordpress.
// Class to create virtual pages
// http://davejesch.com/2012/12/creating-virtual-pages-in-wordpress/
if (!class_exists('DJVirtualPage')) {
class DJVirtualPage {
private $slug = NULL;
private $title = NULL;
private $content = NULL;
private $author = NULL;
private $date = NULL;
private $type = NULL;