• Resolved dotkev

    (@dotkev)


    Is it possible to automate selected CPT and taxonomies for new and existing users?

    I don’t want users to need to worry about configuring.

    I was hoping that define( 'GT_SHOW_ALL', true ); would turn them all on, but it doesn’t appear to work that way.

    Thanks!

    https://wordpress.org/plugins/glance-that/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author uamv

    (@uamv)

    Taxonomies are not available for display.

    By automate, do you mean that all registered CPTs will be shown or a preselected subset of those that might be registered?

    Yes, the GT_SHOW_ALL constant just triggers that all post statuses (not types) are shown.

    Plugin Author uamv

    (@uamv)

    Version 2.1 allows this via a filter. Add something like the following to your functions file.

    function set_default_glances( $glances, $user_id ) {
    
    	$glances['book'] = array( 'icon' => 'f331', 'sort' => 4 );
    	$glances['code'] = array( 'icon' => 'f120' );
    	unset( $glances['page'] );
    
    	return $glances;
    }
    add_filter( 'gt_default_glances', 'set_default_glances', 10, 2 );

    In this case book and code are the custom post type name or item name within Glance That (i.e. user for Users). You will also need to define the default icon to be displayed for the item. Optionally, a sort order can be set.

    Thanks for the feature request. This is a great addition.

    Thread Starter dotkev

    (@dotkev)

    Excellent addition. This is exactly what I needed.

    Thanks so much for this invaluable plugin!

    Plugin Author uamv

    (@uamv)

    Great to hear! Yeah, I also enjoy having this plugin around. Would love for you to drop a review if you’re so inclined and let me know if you stumble upon other tweaks that might benefit your experience. Thanks!

    Thread Starter dotkev

    (@dotkev)

    The sort order wasn’t working for me, so I dove into the plugin code.

    Looks like we need sorted instead of sort:

    function dmh_set_default_glances( $glances, $user_id ) {
      unset( $glances['post'] );
      unset( $glances['comment'] );
      $glances['products'] = array( 'icon' => 'f174', 'sorted' => 5 );
      $glances['solutions'] = array( 'icon' => 'f507', 'sorted' => 6 );
      $glances['markets'] = array( 'icon' => 'f238', 'sorted' => 7 );
      $glances['press-releases'] = array( 'icon' => 'f157', 'sorted' => 8 );
      return $glances;
    }

    It possibly needs to be changed as well when setting the standard defaults on glance-that.php, line 1078-1080.

    Do you have a github repo for this? I’d love to contribute.

    I’ll leave a positive review!

    Plugin Author uamv

    (@uamv)

    Ah, thanks for digging and thanks for the report!

    Yes, I recently added it at https://github.com/UaMV/glance-that. I’m somewhat new to git, so bear with me.

    And, thanks for the review.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Automate selected CPT and Taxonomies?’ is closed to new replies.