Title: Problem with URL String
Last modified: August 20, 2016

---

# Problem with URL String

 *  [cmsdevelopers](https://wordpress.org/support/users/cmsdevelopers/)
 * (@cmsdevelopers)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/problem-with-url-string/)
 * I am using a php calendar script to display a calendar
    [http://wp-developers.com/jim_test/calendar-test/](http://wp-developers.com/jim_test/calendar-test/)
 * Each day on the calendar is generated with an image that contains a dynamic url
   string – the url string values are based on the calendar day, month, year
 * `<a href="<? bloginfo('home'); ?>/event-results?month=<?php echo $calendar->month()?
   >&day=<? echo $number; ?>&year=<?php echo $calendar->year ?>"><?php echo $number?
   ><img src="<? bloginfo('stylesheet_directory'); ?>/calendar/images/bg.png" width
   ="25" height="25" /></a>`
 * On a custom template for event results, I query posts based on values of a url
   string`
 *     ```
       <?php query_posts( 'category-name=Events&month='.$month.'&day='.$day ); ?>
         <?php while (have_posts()) : the_post(); ?>
         <h2><? the_title(); ?></h2>
       <? the_content(); ?>
         <?php endwhile;?>
       ```
   
 * The only problem I run into is that none of the links work except the 25th of
   October ( today ) – however the url strings are correct, so my thoughts are that
   wordpress is rejecting the url strings for some reason.
 * Another thing that is weird is the destination ( Event Results ) is not even 
   using the set custom template – I know this for sure because of the error message.
   It is using index.php as opposed to event-results.php ( Below I have provided
   complete code for event-results.php )
    ( visit the calendar and click the 25th
   to see this work ) can anyone please help.
 * Thanks,
 * ***event-results.php***
 *     ```
       <?
       /*
       Template Name: Event Results
       */
       ?>
       <? get_header(); ?>
       <? $month = $_GET['month'] ?>
       <? $day = $_GET['day'] ?>
       <? $year = $_GET['year'] ?>
       <div id="contentWrapper" class="leftRail">
         <? $left=get_option('of_pages_sidebar_position'); ?>
         <? if($left  == 'left'){ get_sidebar(); } ?>
         <div id="content" class="narrowcolumn" role="main">
         <h1><? echo $month; ?></h1>
         <h2><? echo $day; ?></h2>
         <h3><? echo $year; ?></h3>
         <?php query_posts( 'category-name=Events&month='.$month.'&day='.$day ); ?>
         <?php while (have_posts()) : the_post(); ?>
         <h2><? the_title(); ?></h2>
         <?php the_date('Y-m-d', '<h2>', '</h2>'); ?>
         <div class="price_menu_meter_list"><? the_content(); ?></div>
         <?php endwhile;?>
   
         </div>
         <?  $right=get_option('of_pages_sidebar_position'); ?>
         <? if($right == 'right'){ get_sidebar(); } ?>
         <div class="clear"></div>
       </div>
       <? get_footer(); ?>
       ```
   

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

 *  [sam](https://wordpress.org/support/users/samfusion/)
 * (@samfusion)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/problem-with-url-string/#post-2365429)
 * Is it double installation?
 * You can access the events where there is a event created and stored in db. Example:
   
   [http://wp-developers.com/jim_test/?month=October&day=25&year=2011](http://wp-developers.com/jim_test/?month=October&day=25&year=2011)
   [http://wp-developers.com/jim_test/?month=October&day=14&year=2011](http://wp-developers.com/jim_test/?month=October&day=14&year=2011)
 * You cannot access event for:
    [http://wp-developers.com/jim_test/?month=October&day=”anydate-where-no-event”&year=2011](http://wp-developers.com/jim_test/?month=October&day=”anydate-where-no-event”&year=2011)
 * Also, what is difference between:
    [http://wp-developers.com/jim_test/?month=October&day=25&year=2011](http://wp-developers.com/jim_test/?month=October&day=25&year=2011)
   AND [http://wp-developers.com/jim_test/event-results/?month=October&day=25&year=2011](http://wp-developers.com/jim_test/event-results/?month=October&day=25&year=2011)
 * Are they two installations? Kinda messy, am sorry for confusing.
 *  Thread Starter [cmsdevelopers](https://wordpress.org/support/users/cmsdevelopers/)
 * (@cmsdevelopers)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/problem-with-url-string/#post-2365500)
 * Feel free to login and look:
    un: admin pw: 12345679
 * I am actually creating a fake events calendar by using this php script: [http://coreyworrell.com/calendar/](http://coreyworrell.com/calendar/)–
   I have edited the daily output to
    1) Contain a transparent png that links to
   the events page:[http://wp-developers.com/jim_test/event-results](http://wp-developers.com/jim_test/event-results)
 * 2) Pass a string of variables for month, day, year
 * 3) In a custom template for the events-results page – I accept the values and
   query posts that meet the month, day and year from the string
 * There is no events db tables – only querying posts by date sent via url string
 *  [sam](https://wordpress.org/support/users/samfusion/)
 * (@samfusion)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/problem-with-url-string/#post-2365506)
 * [@cmsdevelopers](https://wordpress.org/support/users/cmsdevelopers/), I am not
   sure I have understood this issue. Any other PHP geek can answer you. However,
   what am I seeing is, the date which has no event created is showing blank. So,
   I think you edit php code to remove hyperlink for non-event dates.
 * More details:
    [http://coreyworrell.com/calendar/documentation.php#custom-events](http://coreyworrell.com/calendar/documentation.php#custom-events)
 *     ```
       <?php
       include 'classes/calendar.php';
   
       $month = isset($_GET['m']) ? $_GET['m'] : NULL;
       $year  = isset($_GET['y']) ? $_GET['y'] : NULL;
   
       $calendar = Calendar::factory($month, $year);
   
       $event1 = $calendar->event()
           ->condition('timestamp', strtotime(date('F').' 21, '.date('Y')))
           ->title('Hello All')
           ->output('<a href="http://google.com">Going to Google</a>');
   
       $event2 = $calendar->event()
           ->condition('timestamp', strtotime(date('F').' 21, '.date('Y')))
           ->title('Something Awesome')
           ->output('<a href="http://coreyworrell.com">My Portfolio</a><br />It\'s pretty cool in there.');
   
       $calendar->standard('today')
           ->standard('prev-next')
           ->standard('holidays')
           ->attach($event1)
           ->attach($event2);
       ```
   
 *  Thread Starter [cmsdevelopers](https://wordpress.org/support/users/cmsdevelopers/)
 * (@cmsdevelopers)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/problem-with-url-string/#post-2365516)
 * [@samfusion](https://wordpress.org/support/users/samfusion/) – what you are saying
   makes however what is weird is that there are no “events” at all – there is no“
   query to the db” for anything – only the calendar is constructed then I am creating
   the url string using the generated date in calendar construction.
 * I then pass the url string to event-results ( which is using a custom template
   page –> event-results.php ). event-results.php only accepts the url data then
   query posts from given date ( month, day, year ) –
 * You can see this working for the 25th: Please see this screen capture: [http://screencast.com/t/EDapgLAs1](http://screencast.com/t/EDapgLAs1)
 * **But why is the an 404 returned on all other dates** – even if no post exists
   the simple echo of url data should show Please see this screen capture: [http://screencast.com/t/EDapgLAs1](http://screencast.com/t/EDapgLAs1)

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

The topic ‘Problem with URL String’ is closed to new replies.

## Tags

 * [calendar](https://wordpress.org/support/topic-tag/calendar/)
 * [custom-template](https://wordpress.org/support/topic-tag/custom-template/)
 * [dynamic url](https://wordpress.org/support/topic-tag/dynamic-url/)
 * [url string](https://wordpress.org/support/topic-tag/url-string/)

 * 4 replies
 * 2 participants
 * Last reply from: [cmsdevelopers](https://wordpress.org/support/users/cmsdevelopers/)
 * Last activity: [14 years, 6 months ago](https://wordpress.org/support/topic/problem-with-url-string/#post-2365516)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
