• Love using the Aaron theme.

    I created a child theme Aaron and wanted under advance settings-> “check this box to hide the clickable site title in the header menu” to always be default checked. How do I modify this on the child theme? do i need to create a new customizer.php file or i can just overwrite under functions.php?

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Theme Author Carolina Nymark

    (@poena)

    Hi!
    Thank you for your kind words.

    Do you want the option to still be available?
    Because it is easier for me to give you the code to remove the title 🙂

    function aaron_child_menu_title() {
    	remove_filter( 'wp_nav_menu_items', 'aaron_menu_title' );
    }
    add_action( 'init', 'aaron_child_menu_title', 10 );
    Thread Starter kenlu89

    (@kenlu89)

    @poena thank you so much for responding! The above code did work but how would that still be options to the users if they want to appear back. Here is so far what i did.

    On functions.php

    <?php
    
    add_action( 'wp_enqueue_scripts', 'poorvu_enqueue_styles' );
    function poorvu_enqueue_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    }
    require_once( get_stylesheet_directory(). '/inc/custom-customizer.php');

    on custom-customizer.php i bascially copy everything from Aaron and on the $wp_customize->add_setting I added default value to be TRUE. that did checked the admin box but the functionality didn’t work. Not sure what i’m missing there. I also copy the customizer.js into child theme as well.

    Theme Author Carolina Nymark

    (@poena)

    Hi
    It is because the function that outputs the title in the menu does not check if the setting is true.
    I cannot change this in the parent theme because it may break existing sites.

    You can try something like the below code:

    
    function aaron_child_menu_title() {
    	remove_filter( 'wp_nav_menu_items', 'aaron_menu_title' );
    }
    add_action( 'init', 'aaron_child_menu_title', 10 );
    
    if ( ! get_theme_mod( 'aaron_hide_title', true ) ) {
    function aaron_child_show_menu_title( $items, $args ) {
    		if ( 'header' === $args->theme_location ) {
    			$new_item    = array( '<li class="toptitle"><a href="' . esc_url( home_url( '/' ) ) . '" rel="home">' . get_bloginfo( 'name' ) . '</a></li>' );
    			$items       = preg_replace( '/<\/li>\s<li/', '</li>,<li', $items );
    			$array_items = explode( ',', $items );
    			array_splice( $array_items, 0, 0, $new_item );
    			$items = implode( '', $array_items );
    		}
    		return $items;
    	}
    	add_filter( 'wp_nav_menu_items', 'aaron_child_show_menu_title', 10, 2 );
    }
    
    Thread Starter kenlu89

    (@kenlu89)

    @poena I added above code into functions.php it doesn’t seeem to do anything. Also, is there an easier way to do this because creating remove filter function for each default settings? I would like to have other default checkbox checked by default like “Check this box to show the excerpt instead of the full content…”

    Really appropriated you help!

    Theme Author Carolina Nymark

    (@poena)

    Hi

    No there is no easier way.
    This theme is 5 years old and not as flexible as a modern theme.
    (In short, I know how to code better now than I did then 😂)

    As I wrote it is not possible for me to update the theme settings, it would need a full rewrite and it would break existing sites.

    Thread Starter kenlu89

    (@kenlu89)

    @poena can’t believe there isn’t a way to do that. The purpose of having a child theme to modify small changes from parent’s theme without affecting them. Let me know if you able to figure out another method.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Child Theme Aaron’ is closed to new replies.