Problem with URL String
-
I am using a php calendar script to display a calendar
https://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(); ?>
- The topic ‘Problem with URL String’ is closed to new replies.