• gottliebjay

    (@gottliebjay)


    Using sportspress rookie theme. When the calendar is displayed, I’m expecting the days that have events on the calendar to be highlighted somehow on the calendar view. The only thing I’m seeing is a different color used for the day number, which is quite hard to see. Usually the day box on the calendar is filled in, or there is some other mark signifying that there is an event on that day.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Roch

    (@rochesterj)

    Hi!

    Thanks for reaching out!

    We can change that with a bit of CSS. Add the following code in your custom css field ( Wp admin > SportsPress > Settings > General > Custom CSS ) and let us know how it works:

    .sp-event-calendar tbody td {
    	position: relative;
    }
    .sp-event-calendar tbody a {
    	background: red;
    	display: table-cell;
    	position: absolute;
    	width: 100%;
    	top: 0px;
    	left: -1px;
    	line-height: 87px;
    }

    Thanks!

    Thread Starter gottliebjay

    (@gottliebjay)

    Thank you very much. I tried this and it does work, but with some issues. When viewing the website on my PC it looks perfect. However, when viewing the website via mobile phone, the size of the red box is wrong. The width is correct, but the height is too high.

    So, I changed the CSS a bit to try to fix this. I tried:
    .sp-event-calendar tbody td {
    position: relative;
    }
    .sp-event-calendar tbody a {
    background: red;
    display: table-cell;
    position: absolute;
    height: 100%;
    width: 100%;
    top: 0px;
    left: 0px;
    line-height: 87px;
    }

    With this, now with both PC and mobile viewing of the website, the red box is the correct size and in the correct location. However, the day number when viewing on mobile is in the wrong place (it is no longer centered in the box, but moved down). It is fine when viewing on PC.

    Any additional help on this would be very, very much appreciated!

    Thanks!

    Roch

    (@rochesterj)

    Hi!

    Thanks for your reply and I’m sorry that my code didn’t work for you.

    In this case I believe you can use media queries for different rules for desktop and mobiles, Something like this:

    @media only screen and (min-device-width: 780px) {
    /* desktops */
    }
    @media only screen and (max-device-width: 780px) {
    /* mobiles*/
    }

    Thanks!

    _drg_

    (@_drg_)

    I found that the default calendar was not really helpful just having the day number in a large box, and I agree the highlighting was not that obvious. I changed the template for the calendar to show the number of games in addition to the day number.
    I did this by copying the events-calendar.php template from the sportspress folder (sportspress/templates/events-calendar.php) into my theme folder. At line 223, I changed this:

    	if ( array_key_exists($day, $daywithpost) ) // any posts today?
    		$calendar_output .= '<a data-tooltip data-options="disable_for_touch:true" class="has-tip" href="' . ( sizeof( $daywithpost[ $day ] ) > 1 ? add_query_arg( array( 'post_type' => 'sp_event' ), get_day_link( $thisyear, $thismonth, $day ) ) . '" title="' . sprintf( '%s events', ( sizeof( $daywithpost[ $day ] ) ) ) : get_post_permalink( $daywithpost[ $day ][0], false, true ) . '" title="' . esc_attr( $ak_titles_for_day[ $day ] ) ) . "\">$day</a>";
    	else
    

    to this:

    	if ( array_key_exists($day, $daywithpost) ) // any posts today?
    	{
    		$calendar_output .= $day;
    
    		$calendar_output .= '<br><a data-tooltip data-options="disable_for_touch:true" class="has-tip" href="' . ( sizeof( $daywithpost[ $day ] ) > 1 ? add_query_arg( array( 'post_type' => 'sp_event' ), get_day_link( $thisyear, $thismonth, $day ) ) . '" title="' . sprintf( '%s %s', ( sizeof( $daywithpost[ $day ] ) ), __( 'Events', 'sportspress' ) ) : get_post_permalink( $daywithpost[ $day ][0], false, true ) . '" title="' . esc_attr( $ak_titles_for_day[ $day ] ) ) . "\"><div>".sprintf( '%s %s', ( sizeof( $daywithpost[ $day ] ) ), __( 'Events', 'sportspress' ) )."</div></a>";
    
    	}
    
    • This reply was modified 7 years ago by _drg_.
    Roch

    (@rochesterj)

    Hi!

    That’s a great idea, actually. Thanks for sharing!

    ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to differentiate days in calendar view that have events vs don’t have events’ is closed to new replies.