Title: creating dynamic pages
Last modified: August 19, 2016

---

# creating dynamic pages

 *  Resolved [Tom Penney](https://wordpress.org/support/users/blots/)
 * (@blots)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/creating-dynamic-pages/)
 * I am attempting to write a plugin which will display a dynamic page based on 
   a GET request. For example:
 * [http://mydomain.com/?showme=thisitem](http://mydomain.com/?showme=thisitem)
 * would display a page with information about “thisitem”.
 * I would also like to make this theme independent so I would like to not require
   a special template. I’m not sure of the best way to do this.
 * I thought this would be the approach to take but I can not figure out how to 
   bulldog my page content into the page. This, of course, doesn’t work but it demonstrates
   what I’m trying to do:
 *     ```
       add_action('init', 'show_item');
   
       function show_item() {
         $showme = $_GET['showme'];
         if ( !empty($showme) ){
           $post="My Dynamic Page Content";
           include(TEMPLATEPATH . '/page.php');
           exit;
         }
       }
       ```
   
 * how do I go about getting my own page content to display like normal page content?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [Tom Penney](https://wordpress.org/support/users/blots/)
 * (@blots)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/creating-dynamic-pages/#post-708118)
 * Can anyone point me in the right direction here?
 *  Thread Starter [Tom Penney](https://wordpress.org/support/users/blots/)
 * (@blots)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/creating-dynamic-pages/#post-708171)
 * As a side note, how does one post in the advanced forum?
 * This is what I ended up doing although I can’t help but think there is a much
   better way to do this. Please, any comments welcome, abusive or otherwise 😉
 * what this does is gets one post then modifies it to contain my content:
 *     ```
       add_action('init', 'show_item');
   
       function show_item() {
         $showme = $_GET['showme'];
         if ( !empty($showme) ){
            add_filter('the_content', 'replace_content');
            add_filter('the_title', 'replace_title');
            add_filter('post_limits', 'limit_1_post' );
            //addfilter([other filters to remove other stuff you dont want to display]);
            add_action('template_redirect', 'replace_template');
         }
       }
   
       function replace_content($text) {
         //do somthing to generate content with $_GET['showme']
         $mycontent = "My Dynamic Content";
         return $mycontent;
       } 
   
       function replace_title($text) {
         return "My Title";
       }
   
       function limit_1_post($limit) {
         return 'LIMIT 1';
       }
   
       function replace_template() {
         include(TEMPLATEPATH . '/page.php');
         exit;
       }
       ```
   
 *  [mike_l](https://wordpress.org/support/users/mike_l/)
 * (@mike_l)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/creating-dynamic-pages/#post-708172)
 * I don’t know… that seems to make sense to me.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘creating dynamic pages’ is closed to new replies.

## Tags

 * [api](https://wordpress.org/support/topic-tag/api/)
 * [dynamic pages](https://wordpress.org/support/topic-tag/dynamic-pages/)

 * 3 replies
 * 2 participants
 * Last reply from: [mike_l](https://wordpress.org/support/users/mike_l/)
 * Last activity: [18 years, 1 month ago](https://wordpress.org/support/topic/creating-dynamic-pages/#post-708172)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
