Using Twitter Bootstrap together with Wordpress

前端 未结 4 573
太阳男子
太阳男子 2021-02-03 15:20

How do I use Wordpress together with Twitter Bootstrap? I know how to set up a Wordpress page and I\'ve already worked with Bootstrap, but now I want to use these two together f

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-03 16:17

    There is a quick way to do it, using composer in your theme:

    composer.json

    {
            "config": {
                            "component-dir": "lib/composer",
                            "vendor-dir": "lib/composer",
                            "bin-dir" : "bin/composer",
                            "cache-dir" : "var/cache/composer"
            },
            "require": {
                            "twitter/bootstrap": "3"
            }
    }
    

    Note: I removed the other composer's section and requirements and phing integration to reduce complexity.

    Execute

     composer install
    

    And then in your theme, add /lib/composer/twitter/bootstrap/dist/css/bootstrap.css with this sentences

        $bootUri = get_template_directory_uri() . '/lib/composer/twitter/bootstrap/dist/css/bootstrap.css';
    
        wp_enqueue_style('sindy_bootstrap', $bootsUri); 
    

    et voilà! :)

提交回复
热议问题