WordPress.org

Ready to get started?Download WordPress

Forums

Finishing touches on styling WordPress blog to look like main site (3 posts)

  1. billyjex
    Member
    Posted 1 year ago #

    Hey there,

    Took over for site. Was kind of a mess but still working with their CSS files. Added a wordpress blog today to try to generate new content.

    This is my first attempt at adding wordpress to an existing site. Can't quite get it looking the same and am hitting some roadblocks.

    Main site= "http://www.solarallianceofamerica.com

    Blog site= "http://www.solarallianceofamerica.com/blog"

    Tutorial= "http://rivergraphics.net/resources-tutorials/how-to-integrate-a-wordpress-blog-into-an-existing-website/"

    The header, nav menu, and footer turned out well. But the body and sidebars are out of whack. The goal is to have the body/sidebars fit under the width of the navmenu.

    The tutorial had me import my general css file from the main site and the css file from the default WP theme, twentyten. So my current css file looks like:

    @import url("../twentyten/style.css");
    
    @import url("http://solarallianceofamerica.com/css/general.css");
    
    #primary, #secondary { width: 240px; }
    
    #mainContent h1, #mainContent h2 { margin-bottom: 20px; }

    So I'm guessing I need to be calling some stuff from the twentyten style. I'm just kinda lost and not making progress. Any help is appreciated, thanks.

    fourfins

  2. Digital Raindrops
    Member
    Posted 1 year ago #

    In Firefox this stylesheet is not importing,

    @import url("http://solarallianceofamerica.com/css/general.css");

    Try up five levels to the root/blog/wp-content/themes/twentyeleven/:

    @import url("../../../../../css/general.css");

    Alternative:
    copy the general.css to the child theme, it will be much more easier to adjust and edit from the child themes folder.

    Remove:

    @import url("http://solarallianceofamerica.com/css/general.css");

    UNTESTED CODE:
    In the child themes functions.php add:

    add_action( 'after_setup_theme', 'child_theme_setup' );
    
    if ( !function_exists( 'child_theme_setup' ) ):
    function child_theme_setup() {
    	if ( !function_exists( 'enqueue_general_style' ) ):
    		function enqueue_general_style() {
    			wp_enqueue_style( 'general_style', get_stylesheet_directory_uri() . '/general.css', array(), null );
    			do_action( 'enqueue_general_style', 'general_style' );
    		}
    		add_action( 'wp_enqueue_scripts', 'enqueue_general_style', 11 );
    	endif;
    }
    endif;

    HTH

    David

  3. billyjex
    Member
    Posted 1 year ago #

    Thanks for the advice. General.css is now in the child theme folder and working with your code. Still gotta work on the body and sidebar!

Topic Closed

This topic has been closed to new replies.

About this Topic