• Resolved ontherun_

    (@ontherun_)


    Hi!
    I’m impressed by, and using Expound for my website. Up until now I have always only changed things in the css of the child-theme that I created, but when it comes to functions I had some problems. I wanted to change some things in the footer (still give you credit Kovshenin!) but change the code a bit, and I was not able to override the functions.
    The footer refers to this line:
    <?php do_action( 'expound_credits' ); ?>

    and I tried to tackle this bit:

    function expound_display_credits() {
    	(...text...)
    	echo apply_filters( 'expound_credits_text', $text );
    }
    add_action( 'expound_credits', 'expound_display_credits' );

    I guess it is this line that I couldn’t really understand:
    echo apply_filters( 'expound_credits_text', $text );
    I tried to do it by adding this to my own functions.php in my child theme:

    remove_action( 'expound_credits', 'expound_display_credits' );
    	add_action('after_setup_theme','remove_footer_actions');
    
    	function my_display_credits() {
    (...text...)
    }
    add_action( 'expound_credits', 'my_display_credits' );

    ..and that was just wrong.
    How can I override some of the functions in Expound with my own?

    (I guess it actually works to just create my own footer.php and write whatever in it, but that is a crude and bad way to do it.

    Best regards
    Oskar

Viewing 2 replies - 1 through 2 (of 2 total)
  • Theme Author Konstantin Kovshenin

    (@kovshenin)

    You can just use the filter to override the text, like this:

    function my_credits_text( $text ) {
        return 'This is my new text.';
    }
    add_filter( 'expound_credits_text', 'my_credits_text' );

    Hope that helps!

    Thread Starter ontherun_

    (@ontherun_)

    Thanks a lot! I’m sorry for responding so late, but I ended up changing a lot as I learned more. I tried this out on my old child theme though, and it worked fine.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Replace Function’ is closed to new replies.