Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

WordPress

Ryan Smee
Ryan Smee
3,392 Points

Wordpress Bootstrap theme not working on mobile

I have been building a Wordpress bootstrap theme for a project that due in on friday. I uploaded my project so far to http://ryansmeetestsite.com/ to test in on my phone and the style sheets and JS files don't seem to be loading? All i'm seeing is a plain text version of the site.

Please help, major panic!

3 Answers

Andrew Shook
Andrew Shook
31,709 Points

It's working for me. Except for your images, but that's because all the images src attribute is pointing at your local host.

Kevin Korte
Kevin Korte
28,135 Points

When I click your link, it's taking me to the initial setup page for Wordpress. I'm guessing you don't want that. :)

What does your functions.php file look like? You're site's back up now

Ryan Smee
Ryan Smee
3,392 Points

Yeah sorry, i took it down quickly to redeploy to see if i had fixed it.. i hadn't.. my funtions.php is as follows

//setting style sheet locations
    function themeStyles() {

        wp_enqueue_style( 'bootstrap_css', get_template_directory_uri() . '/css/bootstrap.min.css' );
        wp_enqueue_style( 'main_css', get_template_directory_uri() . '/style.css' );
    }
    add_action( 'wp_enqueue_scripts', 'themeStyles' );


//fallback for < ie9 
    function themeJS() {

        global $wp_scripts;

        wp_register_script( 'html5Shiv', 'https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js', '', '', false );
        wp_register_script( 'respondJS', 'https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js', '', '', false );
        //load
        $wp_scripts->add_data( 'html5Shiv', 'conditional', 'lt IE 9' );
        $wp_scripts->add_data( 'respondJS', 'conditional', 'lt IE 9' );
        //add
        wp_enqueue_script('jquery');  // Enqueue jQuery that's already built into WordPress

        wp_enqueue_script( 'bootstrap_js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '', true );
        wp_enqueue_script( 'script_js', get_template_directory_uri() . '/js/script-min.js', array('jquery', 'bootstrap_js'), '', true );
    }
    add_action( 'wp_enqueue_scripts', 'themeJS' );


//Customise menu 
    add_theme_support( 'menus' );

    function registerMenus() {
        register_nav_menus(
            array(
                'header-menu' => __( 'Header Menu' )
            )
        );
    }
    add_action( 'init', 'registerMenus');

//setting style sheet locations
    function create_widget( $name, $id, $description ) {
        register_sidebar(array(
            'name' => __( $name ),   
            'id' => $id, 
            'description' => __( $description ),
            'before_widget' => '<div class="widget">',
            'after_widget' => '</div>',
            'before_title' => '<h2>',
            'after_title' => '</h2>'
        ));
    }

    create_widget( 'Section 1 Left Box', 'row1left', 'Row 1 - This is the left section' );
    create_widget( 'Section 1 Left Box2', 'row1left2', 'Row 1 - This is hidden until button 2 is pressed' );
    create_widget( 'Section 1 Left Button', 'leftbutton', 'Row 1 - Left button' );
    create_widget( 'Section 1 Right Button', 'rightbutton', 'Row 1 - Right button' );
    create_widget( 'Section 1 Right Box', 'row1right', 'Row 1 - This is the Right section' );

    create_widget( 'Section 2 Left Box', 'row2left', 'Row 2 - This is the left section' );
    create_widget( 'Section 2 center Box', 'row2center', 'Row 2 - This in the middle section' );
    create_widget( 'Section 2 Right Box', 'row2right', 'Row 2 - This is the right section' );   

    create_widget( 'Section 3 Right Box', 'row3left', 'Row 3 - This is the left section' );
    create_widget( 'Section 3 Right Box', 'row3right', 'Row 3 - This is the right section' );
Ryan Smee
Ryan Smee
3,392 Points

Do you have any thoughts?

Ryan Smee
Ryan Smee
3,392 Points

Yeah i had updated my config file but for some reason it hadn't changed the css & js paths. After a little messign around I think I have sorted it. I now just need to do a find and replace in the db to change the urls from local to ryansmeetestsite.com. Do you know of any good migration tools that can move my wp local to my wp live and make all these changes for me?

Cheers

Kevin Korte
Kevin Korte
28,135 Points

Hey Ryan it's working for me too now! I don't have first hand experience with any plugins built for moving WP sites, but for some reason I think I remember there being a video here about doing this, and the Duplicator plugin was used.

https://wordpress.org/plugins/duplicator/

Ryan Smee
Ryan Smee
3,392 Points

I'm glad it's not just me being silly! Cheers mate, I will have a little look:)