Title: _drg_'s Replies | WordPress.org

---

# _drg_

  [  ](https://wordpress.org/support/users/_drg_/)

 *   [Profile](https://wordpress.org/support/users/_drg_/)
 *   [Topics Started](https://wordpress.org/support/users/_drg_/topics/)
 *   [Replies Created](https://wordpress.org/support/users/_drg_/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/_drg_/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/_drg_/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/_drg_/engagements/)
 *   [Favorites](https://wordpress.org/support/users/_drg_/favorites/)

 Search replies:

## Forum Replies Created

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

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[CMB2] Trying to get cmb_styles options working](https://wordpress.org/support/topic/trying-to-get-cmb_styles-options-working/)
 *  Thread Starter [_drg_](https://wordpress.org/support/users/_drg_/)
 * (@_drg_)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/trying-to-get-cmb_styles-options-working/#post-9887319)
 * Another random thought. What if you added a cmb_styles_prefix option for creating
   metaboxes. Then, in the code that renders the html, it could prepend that text
   to each of the styles it puts out. You could then load the cmb style sheet no
   matter what.
    By default, the cmb_styles_prefix would be blank, and therefore
   the styles would match the cmb stylesheet. Otherwise, the styles would have new
   names and not rely on the stylesheet, and would allow someone to create custom
   styles where needed.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[CMB2] Trying to get cmb_styles options working](https://wordpress.org/support/topic/trying-to-get-cmb_styles-options-working/)
 *  Thread Starter [_drg_](https://wordpress.org/support/users/_drg_/)
 * (@_drg_)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/trying-to-get-cmb_styles-options-working/#post-9887291)
 * Thanks for taking the time to look into this and for the response!
 * If I am reading it correctly, then I think you answered my initial question.
 * > So, does the cmb_styles argument just affect the loading of the stylesheet (
   > meaning if any cmb2 box/field has it, it’s loaded for everyone), or does it
   > affect adding style names/classes to the elements?
 * The argument just affects whether the stylesheet loads (all or nothing).
 * Some feedback:
    Because cmb_styles is an argument/option at the metabox level(
   i.e. when you create a metabox) it seems to imply that the option applies to 
   that metabox, and can be different for each metabox. However, regardless of how
   many metaboxes are on a page, if one has cmb_styles=true (or all but one have
   cmb_styles=false), then the result is as if all of them were =true.
 * I am not a big coder, so dont’ know the implications of this, but:
    A) Given 
   it’s current behavior, it would make sense to me if cmb_tyles was an independent
   setting (not by metabox), OR, B) It would make sense if the argument was per 
   metabox, and that the metabox html that is rendered would just omit the style
   parameters if cmb_styles=false.
 * I like the idea of having it be specific to each metabox so I’d submit a feature
   request for #B.
 * Either way, CMB2 has been a huge help to what I am working on. Thanks for all
   your hard work!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[CMB2] Trying to get cmb_styles options working](https://wordpress.org/support/topic/trying-to-get-cmb_styles-options-working/)
 *  Thread Starter [_drg_](https://wordpress.org/support/users/_drg_/)
 * (@_drg_)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/trying-to-get-cmb_styles-options-working/#post-9859409)
 * Sorry for the misunderstanding – i’ve posted the code below.
    I did try changing
   the order of the metaboxes (the add action) with no apparent affect.
 *     ```
       <?php
       add_action( 'cmb2_admin_init', 'ohl_usahockey_metaboxes' );
   
       function ohl_usahockey_metaboxes() {
   
       	// Start with an underscore to hide fields from custom fields list
       	$prefix = '_ohl_';
   
       	/**
       	 * Create the scoresheet metabox
       	 */
       	$cmb = new_cmb2_box( array(
       		'id'            => 'ohl_usahockey',
       		'title'         => __( 'USA Hockey', 'ohl' ),
       		'object_types'  => array( 'sp_player', ), // Post type
       		'context'       => 'side',
       		'priority'      => 'high',
       		'show_names'    => true, // Show field names on the left
       		//'cmb_styles' => false, // false to disable the CMB stylesheet
       		// 'closed'     => true, // Keep the metabox closed by default
       	) );
   
       	$cmb->add_field( array(
       		'name' => esc_html__( 'Current USA Hockey #', 'ohl' ),
       		'id'   => $prefix . 'usahockey_current_number',
       		'type' => 'text_medium',
       		//'cmb_styles' => false, // false to disable the CMB stylesheet
       	) );
   
       	$cmb->add_field( array(
       		'name' => esc_html__( 'Expires', 'ohl' ),
       		'id'   => $prefix . 'usahockey_current_expires',
       		'type' => 'text_date',
       		'date_format' => 'm/d/yy',
       		//'cmb_styles' => false, // false to disable the CMB stylesheet
       	) );
       }
   
       add_action( 'cmb2_admin_init', 'ohl_player_reg_metabox' );
   
       function ohl_player_reg_metabox() {
   
       	// Start with an underscore to hide fields from custom fields list
       	$prefix = '_ohl_';
   
       	$cmb_group = new_cmb2_box( array(
       		'id'           => $prefix . 'player_reg_metabox',
       		'title'        => esc_html__( 'Player Registrations', 'ohl' ),
       		'object_types' => array( 'sp_player' ),
       		'context'       => 'normal',
       		'priority'      => 'high',
       		'show_names'    => true, // Show field names on the left
       		//'cmb_styles' => false, // false to disable the CMB stylesheet
       		// 'closed'     => true, // Keep the metabox closed by default
       	) );
   
       	$group_field_id = $cmb_group->add_field( array(
       		'id'          => $prefix . 'playerreg_row',
       		'type'        => 'group',
       		//'description' => esc_html__( 'Generates reusable form entries', 'ohl' ),
       		'options'     => array(
       			'group_title'   => esc_html__( 'Registration {#}', 'ohl' ), // {#} gets replaced by row number
       			'add_button'    => esc_html__( 'Add Registration', 'ohl' ),
       			'remove_button' => esc_html__( 'Remove', 'ohl' ),
       			'sortable'      => true, // beta
       			// 'closed'     => true, // true to have the groups closed by default
       		),
       	) );
   
       	/**
       	 * Group fields works the same, except ids only need
       	 * to be unique to the group. Prefix is not needed.
       	 *
       	 * The parent field's id needs to be passed as the first argument.
       	 */
       	$cmb_group->add_group_field( $group_field_id, array(
       		'name'       => esc_html__( 'Season', 'ohl' ),
       		'id'         => $prefix . 'playerreg_season',
       		'type'       => 'text',
       		// 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types)
       	) );
   
       	$cmb_group->add_group_field( $group_field_id, array(
       		'name'             => esc_html__( 'Payment Status', 'cmb2' ),
       		'id'               => $prefix . 'playerreg_payment',
       		'type'             => 'radio',
       		//'show_option_none' => 'No Selection',
       		'options'          => array(
       			'standard' => esc_html__( 'None', 'cmb2' ),
       			'custom'   => esc_html__( 'Partial', 'cmb2' ),
       			'none'     => esc_html__( 'Paid in Full', 'cmb2' ),
       		),
       	) );
   
       	$cmb_group->add_group_field( $group_field_id, array(
       		'name'    => esc_html__( 'Registration Documents', 'cmb2' ),
       		'id'      => $prefix . 'playerreg_docs',
       		'type'    => 'multicheck',
       		// 'multiple' => true, // Store values in individual rows
       		'options' => array(
       			'regform' => esc_html__( 'Registration Form', 'cmb2' ),
       			'waiver' => esc_html__( 'Waiver', 'cmb2' ),
       			'usahockey' => esc_html__( 'USA Hockey', 'cmb2' ),
       		),
       		// 'inline'  => true, // Toggles display to inline
       	) );
       }
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[CMB2] Trying to get cmb_styles options working](https://wordpress.org/support/topic/trying-to-get-cmb_styles-options-working/)
 *  Thread Starter [_drg_](https://wordpress.org/support/users/_drg_/)
 * (@_drg_)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/trying-to-get-cmb_styles-options-working/#post-9857493)
 * Wordpress 4.9.1
    CMB2 2.3.0 SportsPress 2.5.4 PHP Version: 7.0.21 MySQL Version:
   5.7.19-log Let me know what else I can provide to help.
 * Here are the results of some testing.
 * With just the one CMB2 metabox on the post (and no other CMB2 boxes anywhere),
   the control will honor the cmb_styles directive (as expected), and without the
   cmb_styles argument, it will show the style (as expected).
 * When I add another CMB2 metabox on the post; if both have no cmb_styles arg, 
   then both show the cmb2 style. If both have the cmb_styles=false, then neither
   show the style.
    However, if either one has the argument and the other doesn’t,
   both show the cmb2 style.
 * Additionally, I noticed that if I only have the one cmb2 metabox on the post,
   and have the styles=false argument, it won’t show (as expected), BUT if I just
   add the cmb_examples.php with an include in functions.php), the one metabox on
   my post shows the cmb2 style regardless of the argument.
 * Thanks again for your time and help!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[SportsPress - Sports Club & League Manager] Pending Review list?](https://wordpress.org/support/topic/pending-review-list/)
 *  [_drg_](https://wordpress.org/support/users/_drg_/)
 * (@_drg_)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/pending-review-list/#post-9665311)
 * I would second the request for a pro forum so we can find solutions quicker than
   waiting for support response. It would reduce the pro support time (answering
   duplicate requests) as well.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[SportsPress - Sports Club & League Manager] How to differentiate days in calendar view that have events vs don’t have events](https://wordpress.org/support/topic/how-to-differentiate-days-in-calendar-view-that-have-events-vs-dont-have-events/)
 *  [_drg_](https://wordpress.org/support/users/_drg_/)
 * (@_drg_)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/how-to-differentiate-days-in-calendar-view-that-have-events-vs-dont-have-events/#post-9665309)
 * 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 8 years, 9 months ago by [_drg_](https://wordpress.org/support/users/_drg_/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[SportsPress - Sports Club & League Manager] Event CSV Import Issue](https://wordpress.org/support/topic/event-csv-import-issue/)
 *  [_drg_](https://wordpress.org/support/users/_drg_/)
 * (@_drg_)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/event-csv-import-issue/#post-9648482)
 * I’ve had trouble importing as well. For me, it turned out to be a memory problem.
   I had to increase the memory allocated to WP (and memory limit in PHP).
    Some
   troubleshooting steps to try:
 * – If you remove oinks_ data/lines from the file and it stops at about the same
   place, then its probably memory.
    – If you try and import only the oinks_ data/
   linese and it works, then it’s more proof that it’s probably a memory problem.–
   If you remove oinks_ data/lines from the file and it all imports, then i probably
   isn’t a memory problem -it’s probably a special character problem.
 * I can’t remember exactly what I had to change (something in wp-config, as well
   as a PHP setting with the host). In the end, I still run out of memory if the
   file is too big. So I cut it into chunks and import.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[SportsPress - Sports Club & League Manager] Calender Blocks seems bugged it looks just ugly](https://wordpress.org/support/topic/calender-blocks-seems-bugged-it-looks-just-ugly/)
 *  [_drg_](https://wordpress.org/support/users/_drg_/)
 * (@_drg_)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/calender-blocks-seems-bugged-it-looks-just-ugly/#post-9648441)
 * I agree that the calendar blocks elements seem out of order. The nice thing is
   that SportsPress uses a template for this, so you can change it.
    Copy the file`[
   Your WP Dir]/wp-content/plugins/sportspress/templates/event-blocks.php` in to
   your theme directory `[Your WP Dir]/wp-content/themes/[Your Theme Dir]/event-
   blocks.php`
 * You can then edit that file and change how the blocks look (and it won’t get 
   lost when you update sportspress).
 * For example, in that file, lines 145-147 are where the names, or “title” (i.e.
   Team vs Team) is displayed. You could move those three lines to before line 133
   and it would put the name in a place that makes more sense (at least to me).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[SportsPress - Sports Club & League Manager] Suggestion for Schedule List range option](https://wordpress.org/support/topic/suggestion-for-schedule-list-range-option/)
 *  Thread Starter [_drg_](https://wordpress.org/support/users/_drg_/)
 * (@_drg_)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/suggestion-for-schedule-list-range-option/#post-9632095)
 * Oh, and a correction to my initial post. The code is in sportspress/includes/
   class-sp-calendar.php (not class-sp-schedule.php).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[SportsPress - Sports Club & League Manager] Auto Event Outcome Conditions question](https://wordpress.org/support/topic/auto-event-outcome-conditions-question/)
 *  Thread Starter [_drg_](https://wordpress.org/support/users/_drg_/)
 * (@_drg_)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/auto-event-outcome-conditions-question/#post-9632092)
 * That’s what I figured, thank you!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[SportsPress - Sports Club & League Manager] Suggestion for Schedule List range option](https://wordpress.org/support/topic/suggestion-for-schedule-list-range-option/)
 *  Thread Starter [_drg_](https://wordpress.org/support/users/_drg_/)
 * (@_drg_)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/suggestion-for-schedule-list-range-option/#post-9632090)
 * I wanted to follow up on this with another consideration for you (a change I 
   needed to make). Due to the timezone issue (see my other post on same day), the
   new DateTime() was not working as expected. I added the timezone to the call 
   to make sure it worked correctly for my installation:
 *     ```
       $to = new DateTime( $this->to, new DateTimeZone( get_option( 'timezone_string' ) ) );
       $from = new DateTime( $this->from, new DateTimeZone( get_option( 'timezone_string' ) ) );
       ```
   
    -  This reply was modified 8 years, 9 months ago by [_drg_](https://wordpress.org/support/users/_drg_/).

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