WordPress.org

Ready to get started?Download WordPress

Forums

Customizr
Full width with custom-page template (PHP,CSS) (1 post)

  1. ChrisFo
    Member
    Posted 7 months ago #

    I'm struggling to insert a clean CSS style for forcing some special subpages to present content with full screen width. I have added a custom template and activated it on the page and was trying to register a CSS for clean insertion in the header. As it was not possible to set it up I have now inserted a ugly inline CSS. Both the PHP and CSS code from custom-page-full-width.php:

    <?php
    /*
    Template Name: Custom Page Full Width
    */
    ?>
    
    <?php
    // Full Width Code
    // Register Style
    function full_width_styles() {
    
    	wp_register_style( 'full_width_container', get_template_directory_uri() . '/custom-page-full-width.css', false, '0.5', 'all' );
    
    }
    // Hook into the 'wp_enqueue_scripts' action
    add_action( 'wp_enqueue_scripts', 'full_width_styles' );
    ?>
    
    <?php do_action( '__before_main_wrapper' ); ##hook of the header with get_header ?>
    <style type="text/css" media="screen">
    /* full width page (custom template) */
    .container, .navbar-static-top .container, .navbar-fixed-top .container, .navbar-fixed-bottom .container {
    	width: 96%;
    }
    .span9 {
    width: 100%;
    }
    </style>
    
    <div id="main-wrapper" ... (etc. -- standard code)

Reply

You must log in to post.

About this Theme

About this Topic