Support » Plugin: commonWP » Does Not Rewrite Theme URL

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Milan Dinić


    That theme is on GitHub, not on Theme Repository. By default, commonWP will not try to use /gh path unless theme/plugin mentions its GitHub repository details by supporting GitHub Updater.

    However, there are various filters in place that should help. In this case, this snippet looks like it should be most helpful:

    add_filter( 'commonwp_theme_from_slug', function( $data, $slug ) {
    	if ( 'Genesis Sample' == $data['data']->get( 'Name' ) ) {
    		// Get headers property of WP_Theme instance.
    		$headers = ( new ReflectionClass( get_class( $data['data'] ) ) )->getProperty( 'headers' );
    		// Set that property as accessible to be able to read it.
    		$headers->setAccessible( true );
    		// Get property value by passing WP_Theme instance again.
    		$value = $headers->getValue( $data['data'] );
    		$value['GitHub Theme URI'] = '';
    		$headers->setValue( $data['data'], $value );
    	return $data;
    }, 10, 2 );

    What this snippet does is it adds GitHub repository details to the theme as if the theme supported GitHub Updater.

    Note that you should clean your commonWP cache before it starts to work.

    Thread Starter Kunal Desai


    Thanks its working.

    Thread Starter Kunal Desai


    How to enable on the fly minification for these files?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Does Not Rewrite Theme URL’ is closed to new replies.