• I recently created a child theme so I could make changes in the function.php file. I am wanting to be able to change the default timeout for a password on a password protected page. I queried the forum and was provided the code to add to my function.php file in the child directory.

    I have also set the child theme to the active theme.

    What follows is how the file currently looks. The time out on the password doesn’t appear to work. Did I add the code incorrectly?

    <?php
    // Exit if accessed directly
    if ( !defined( 'ABSPATH' ) ) exit;
    
    // BEGIN ENQUEUE PARENT ACTION
    // AUTO GENERATED - Do not modify or remove comment markers above or below:
    
    if ( !function_exists( 'chld_thm_cfg_parent_css' ) ):
        function chld_thm_cfg_parent_css() {
            wp_enqueue_style( 'chld_thm_cfg_parent', trailingslashit( get_template_directory_uri() ) . 'style.css', array(  ) );
        }
    endif;
    add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css', 10 );
             
    if ( !function_exists( 'child_theme_configurator_css' ) ):
        function child_theme_configurator_css() {
            wp_enqueue_style( 'chld_thm_cfg_separate', trailingslashit( get_stylesheet_directory_uri() ) . 'ctc-style.css', array( 'chld_thm_cfg_parent','the-wp-theme-style','font-awesome','the-wp-rippler-css' ) );
        }
    endif;
    add_action( 'wp_enqueue_scripts', 'child_theme_configurator_css' );
    
    // END ENQUEUE PARENT ACTION
    // Alter time for resetting password on password protected pages
    // Code provided by WordPress forum.
    
    function wpse_191369_post_password_expires() {
        return time() + 10; // Expire in 10 seconds
    }
    add_filter( 'post_password_expires', 'wpse_191369_post_password_expires' );

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Modifying the function.php file in a child theme’ is closed to new replies.