Okay
  Public Ticket #859037
creating a new home page template
Closed

Comments

  •  2
    Trent started the conversation

    Hello Boxy,

    I'm trying to make a new home page template. I copied page.php and added the usual comment to make it a template. It's in my child theme folder and in my parent theme folder. It shows up in my template list on the home page, but when I switch it, I lose all of the theme options for the home page. They don't show up in admin, so I can't edit unless I switch back to the default template.

    Help!

    Trent Jones

  •  57
    Justin replied

    This is because Forgiven hides the page settings when anything other than Default is selected. You will need to edit the following file:

    /forgiven/_theme_settings/custom-fields/ecf_custom.js

    In the very beginning of that file, you will see the following code:

    var page_template_val = $('#page_template').val();
    if (page_template_val != 'default'){
        $('#page_settings_panel').slideUp('fast');
    } else {
        $('#page_settings_panel').slideDown('fast');
    }
    
    $('#page_template').on('change',function(){
            
        $cur_val = $(this).val();
            
        if ($cur_val != 'default'){
            $('#page_settings_panel').slideUp('fast');
        } else {
            $('#page_settings_panel').slideDown('fast');
        }
            
    });
    

    You will need to add your own page template file name to the list of allowed options. So for example, if your custom page template is called custom-homepage.php then you will use the following code:

    var page_template_val = $('#page_template').val();
    if (page_template_val != 'default' && page_template_val != 'custom-homepage.php'){
        $('#page_settings_panel').slideUp('fast');
    } else {
        $('#page_settings_panel').slideDown('fast');
    }
    
    $('#page_template').on('change',function(){
            
        $cur_val = $(this).val();
            
        if ($cur_val != 'default' && $cur_val != 'custom-homepage.php'){
            $('#page_settings_panel').slideUp('fast');
        } else {
            $('#page_settings_panel').slideDown('fast');
        }
            
    });
    

    — Justin Scheetz


    Need professional theme/plugin customizations?
    Check the awesome folks at WP Kraken!

  •  2
    Trent replied

    Awesome, thanks Justin! 

    Just replace the new with the old? Or add that at the beginning or end of the other?

    Trent

  •  57
    Justin replied

    Replace it with the new code. But you'll need to change the custom-homepage.php part to whatever your new template is called. :)

    — Justin Scheetz


    Need professional theme/plugin customizations?
    Check the awesome folks at WP Kraken!