Show Sidebar Log in
Commons In A Box Logo
  • Home
  • About
    • Project Team
    • Logos and Graphics
  • Showcase
    • CBOX Classic Showcase
    • CBOX OpenLab Showcase
  • Demo
  • Get Started
  • Documentation
    • Technical Guide
    • CBOX Classic Guide
    • CBOX OpenLab Guide
  • Support Forums
    • CBOX Classic
    • CBOX OpenLab
    • Developers Forum
  • News

Group Admins

  • Profile picture of Scott Voth

CBOX Classic Support

Public Group active 5 months, 1 week ago

This group provides support for Commons In A Box Classic, our original software for community-building. Register for an account or log in to commonsinabox.org, then join the group and post your question here.

What's the best way to install a new font in a CBOX child theme?

Tagged: fonts

  • This topic has 3 replies, 2 voices, and was last updated 11 years ago by Christian Wach.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • May 2, 2014 at 4:40 pm #4689
    Jonathan
    Participant

    I’d like to install a new font in my CBOX child theme, but I’m unsure of the best-practices way to do that. I know I can copy over assets/fonts/fonts.css and modify it, but then iconsweetsregular breaks, because the paths are relative to cbox-theme. I can change the paths for the iconsweetsregular font files to ../../../cbox-theme/assets/fonts/ but that seems like a bit of a messy hack to me. I tried adding a new CSS file to assets/fonts but it doesn’t seem to be getting queued, and I think font CSS files seem like they belong in assets/fonts. What’s the best way to install a new font?

    May 2, 2014 at 7:28 pm #4690
    Christian Wach
    Participant

    @jreeve I posted a workaround here:
    https://commonsinabox.org/groups/help-support/forum/topic/submenu-icons-iconsweets/#post-3097

    And there’s an open ticket here:
    https://github.com/cuny-academic-commons/cbox-theme/issues/159

    I tend to have locahost, dev and live installs for most projects and often used to get caught out by this. In the absence of a fix (I don’t understand the Infinity CSS parser) I simply enqueue my own stylesheets. Life’s too short to debug dynamic.css, though I gather there’ll be a way of switching aggregation off in an upcoming version of the engine.

    May 21, 2014 at 12:45 pm #4752
    Jonathan
    Participant

    @haystack Out of curiosity, how are you enqueuing your own stylesheets? That may indeed be easier than debugging from dynamic.css, which for me involves a ridiculous amount of grepping.

    May 21, 2014 at 1:19 pm #4753
    Christian Wach
    Participant

    @jreeve This is what I do:

    /** 
     * Enqueue Custom CSS in CBOX child theme
     */
    function my_cbox_enqueue_styles() {
    	
    	// load our custom CSS
    	wp_enqueue_style( 
    		'my_child_styles',
    		get_stylesheet_directory_uri() . '/assets/css/my-child-styles.css',
    		array( '@:dynamic' ),
    		0.1, // version
    		'all' // media
    	);
    	
    	// if we've got the homepage template...
    	if ( is_page_template('templates/homepage-template.php') ) {
    		
    		// force flexslider CSS to load
    		wp_enqueue_style( 
    			'flex_slider',
    			get_template_directory_uri() . '/assets/css/flexslider/flexslider.css',
    			null, // array( 'deps' ),
    			0.1, // version
    			'all' // media
    		);
    		
    	}
    	
    }
    
    // add a filter for the above
    add_action( 'wp_enqueue_scripts', 'my_cbox_enqueue_styles', 100 );

    In case you’re wondering, I found that the flexslider CSS doesn’t load on child themes, which is why I force it to load. Would be interested to hear if you see the same behaviour.

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Log In
Group logo of CBOX Classic Support
  • Home
  • Forum
  • Announcements
  • Docs
  • Members 287
  • Send Invites

Groups

Newest | Active | Popular | Alphabetical
  • Group logo of CBOX Classic Support
    CBOX Classic Support
    287 members
  • Group logo of CBOX Pioneers
    CBOX Pioneers
    71 members
  • Group logo of CBOX Developers
    CBOX Developers
    40 members
  • Group logo of CBOX OpenLab Support
    CBOX OpenLab Support
    22 members
  • Group logo of CBOX-OL Testing Partners
    CBOX-OL Testing Partners
    12 members

CBOX has its roots in the CUNY Academic Commons, which in turn was made possible through funding from The City University of New York itself.

CUNY Logo

CUNY Academic Commons Logo

City Tech logo

The Commons In A Box was made possible through the generous support of the Alfred P. Sloan Foundation.

Alfred P. Sloan Foundation Logo

NEH Logo

The CUNY Graduate Center has directly contributed to the CUNY Academic Commons, housing the project since its inception, and has contributed to CBOX through its GC Digital Initiatives.

CUNY Graduate Center Logo

CUNY Graduate Center Digital Initiatives Logo

Powered by Commons In A Box
css.php
Skip to toolbar
  • About WordPress
    • WordPress.org
    • Documentation
    • Learn WordPress
    • Support
    • Feedback
  • Log In
  • Register