• Hello All,

    I’m creating a website using a child theme from WordPress 2017. I’ve set a specific page as my posts page. However, once I do that, i can no longer age a custom page template to that specific page.

    I would like to add some simple custom css to my posts page.

    is there a way that I can modify the single.php page to add some simple css customization?

    I could solve this issue, if I could change

    <div id=”primary” class=”content-area”>

    to

    <div id=”primary” class=”content-area-about”>

    But I can’t seem to override the single.php page in a child theme.

    Any help in the right direction is greatly appreciated.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • @kodave2012

    You could combine is_single and wp_add_inline_style

    Another simple way would to add the class you want, so change this in single.php
    <div id=”primary” class=”content-area”>
    to this
    <div id=”primary” class=”content-area content-area-about”>

    OR
    Just use post_class like this for example

    function example_add_post_class_to_single_post( $classes ) {
    	if ( is_single() ) {
    		array_push( $classes, 'content-area-about' );
    	} // end if
    	
    	return $classes;
    }
    add_filter( 'post_class', 'example_add_post_class_to_single_post' );

    Tell me if I can help further.

    SYA ??

    • This reply was modified 7 years, 9 months ago by LebCit.
    • This reply was modified 7 years, 9 months ago by LebCit.
    Thread Starter kodave2012

    (@kodave2012)

    Thank you for your help

    You are most welcome @kodave2012
    Could you change the status of this question to resolved ?
    SYA

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add custom css to single php page’ is closed to new replies.