0

I created a custom header option in the customizer and am having a few problems i just cant work out. All the codes are working, ive checked multiple tutorials as well as the wp codex and cant seem to work it out. The page, fields and preview are all working, when i click save and publish it shows the working icon and then finishes with no errors. When i try refresh the page or go back however, the browser tells me navigating away will not save any changes, if i do that and refresh, the changes are not saved. Secondly while the default color i selected shows in the preview with all other changes, on the frontend the changes do not show (maybe because its not saving, so need to resolve that first). Below is my functions code.

PROBLEM SOLVED: Allocated Memory Ran Out. Increased it in the HTACCESS file.

// =========================================================================== //
// ADD HEADER IMAGE AND COLOR TO CUSTOMIZER
// =========================================================================== //

function customizer_header( $wp_customize ) {

    // ADD SECTIONS
    $wp_customize->add_section( 'header_section', array(
        'title'          => __( 'Navigation Bar', 'dc_header' ),
        'priority'       => 80,
    ) );

    // ADD SETTINGS
    $wp_customize->add_setting( 
        'header_color', 
        array(
        'default' => '#09c',
        'sanitize_callback' => '',
        ) 
    );

    $wp_customize->add_setting( 
        'header_image', 
        array(
        'default' => '',
        'sanitize_callback' => '',
        ) 
    );

    // ADD CONTROLS
    $wp_customize->add_control( 
        new WP_Customize_Color_Control( 
            $wp_customize, 
            'header_color_control', 
            array(
            'label'      => __( 'Header Color', 'dc_header_color' ),
            'section'    => 'header_section',
            'settings'   => 'header_color',
            ) 
        ) 
    );

    $wp_customize->add_control( 
        new WP_Customize_Image_Control( 
            $wp_customize, 
            'header_image', 
            array(
            'label'      => __( 'Header Image', 'dc_header_image' ),
            'section'    => 'header_section',
            'settings'   => 'header_image',
            ) 
        ) 
    );

}

add_action( 'customize_register', 'customizer_header' );

// ADD TO FRONTEND
function dc_header_css() {
?>
<style type="text/css">
    header { background: <?php echo get_theme_mod( 'header_color' ); ?>; }
</style>
<?php
}
add_action( 'wp_head', 'dc_header_css' );
5
  • First things first, do you debugging enabled? Commented Sep 24, 2015 at 12:17
  • debug and debug_log are both on. Commented Sep 24, 2015 at 12:38
  • Fixed it now, it was the allocated memory running out so upped it in the htaccess file. Thanks for the help. Commented Sep 24, 2015 at 12:54
  • @NicholasRitson Please answer your question and chose that answer, this will be very useful to other people. Commented Sep 26, 2015 at 10:45
  • Done now, sorry there was no option to answer it on a comment and i wasnt able to post my own answer on friday as it said i needed to wait. Commented Sep 27, 2015 at 15:04

1 Answer 1

-1

PROBLEM SOLVED: Allocated Memory Ran Out. Increased it in the HTACCESS file.

Thanks TheDeadMedic.

1
  • 1
    It would help other users know how you increased memory in .htaccess :-)
    – Steve
    Commented Mar 17, 2017 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.