• In the color scheme of my theme (child of CommentPress-Flat), the page didn’t visually distinguish itself from the comment area. So I added a background-image/repeat to fix that. But apparently, I have to put it into the ‘page_wrapper’ class, and that only works in the parent’s ‘screen.min.css. When I added an ‘assets/css’ subdirectory in my child theme directory, the background did not seem to be transmitted. The problem is that I will lose the background, anytime you update CommentPress. Is there a trick, to do it in the child theme directory?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Christian Wach

    (@needle)

    I enqueue my child theme stylesheets like this:

    /**
     * Enqueue child theme styles.
     *
     * Styles can be overridden because the child theme is:
     * 1. enqueueing later than the CommentPress Flat Theme
     * 2. making the file dependent on the CommentPress Flat Theme's stylesheet
     */
    function commentpress_child_enqueue_styles() {
    
    	// dequeue parent theme colour styles
    	//wp_dequeue_style( 'cp_webfont_lato_css' );
    	//wp_dequeue_style( 'cp_colours_css' );
    
    	// add child theme's css file
    	wp_enqueue_style(
    		'commentpress_child_css',
    		get_stylesheet_directory_uri() . '/assets/css/commentpress-child.css',
    		array( 'cp_screen_css' ),
    		'0.1', // version - bump this to force CSS to reload
    		'all' // media
    	);
    
    }
    
    // add action for the above
    add_action( 'wp_enqueue_scripts', 'commentpress_child_enqueue_styles', 998 );
    

    Cheers, Christian

    Thread Starter papaworx

    (@papaworx)

    If I may impose, the enqueuing syntax is a bit difficult to follow. If I want to include a stylesheet ‘screen.min.css’, situated in /assets/css/ under the template directory, can I enqueue that file by including the following line in the myTheme_enqueue_styles function:
    wp_enqueue_style( 'screen.min', get_template_directory_uri().'/assets/css/screen.min.css',false,'1.1','all');
    I would feel considerably more confident, if you put your stamp of approval on it, and I won’t hold you liable ;-}

    Plugin Author Christian Wach

    (@needle)

    It may look complex, but it should just work if you copy the code I wrote and paste it into your ‘functions.php’ file, then add a CSS file called ‘commentpress-child.css’ to the ‘assets/css’ folder of the child theme. The dependency is quite important, since you want your CSS file to follow the main CommentPress one so that you can override styles defined in it.

    Cheers, Christian

    Thread Starter papaworx

    (@papaworx)

    Thanks Christian. Since I also had some other problems, I have switched from Flat to Modern, and am very happy with the results. I don’t need to enqueue a local copy of screen.min.css.
    I do have another question, however: I have converted the page-curl images to .png, so I could make the page navigation background transparent rather than white. It works well for the two top links. The arrow shows on the bottom links, and they allow moving to the next, resp. previous page. But the corner doesn’t curl on ‘hover’, and I can’t figure out how you did it. All the four page-curls have the double image (straight arrow/arrow with curl). But the bottom ones won’t switch on ‘hover’.

    Plugin Author Christian Wach

    (@needle)

    @papaworx I think you have some confusion in your CSS declarations – you’re assigning the wrong image to the location and overriding the background-position when the link is in the hover state. Clear these up and it should work.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Child theme background image’ is closed to new replies.