• I have recently installed Reverie theme framework, which a versatile HTML5 Responsive WordPress Framework based on the Foundation framework.

    Im trying to replace the following function (in reverie):

    function reverie_entry_meta() {
    	echo '<time class="updated" datetime="'. get_the_time('c') .'" pubdate>'. sprintf(__('Posted on %s at %s.', 'reverie'), get_the_time('l, F jS, Y'), get_the_time()) .'</time>';
    	echo '<p class="byline author vcard">'. __('Written by', 'reverie') .' <a href="'. get_author_posts_url(get_the_author_meta('ID')) .'" rel="author" class="fn">'. get_the_author() .'</a></p>';
    }

    Using this function (in the child theme function.php)

    if (!function_exists('reverie_entry_meta')) {
    	function reverie_entry_meta() {
    		echo '<time class="updated" datetime="'. get_the_time('c') .'" pubdate>'. sprintf(__('%s at %s.', 'reverie'), get_the_time('l, F jS, Y'), get_the_time()) .'</time>';
    		echo '<p class="byline author vcard">'. __('Written by', 'reverie') .' <a href="'. get_author_posts_url(get_the_author_meta('id')) .'" rel="author" class="fn">'. get_the_author() .'</a></p>';
    	}
    }

    This does not work. I could modify the parent function.php, but that defeats the purpose of the reason for using a child theme – so that is not an option.

    How do I get this to work?
    Thank you for your time and your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The solution is not so hard. If the parent theme contains a function that begins with:
    if (!function_exists('reverie_entry_meta')) {
    then you simply add this:
    function reverie_entry_meta() {};
    to your child theme’s functions.php.

    Thread Starter Phil-ip

    (@phil-ip)

    Thank you photocurio!
    I guess that way of handling the parent function would be transferable to other child themes as well? Just to make sure that I understand the code, are you creating an empty function in the childthemes function.php?

    Thank you for your time and help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘child theme function.php override or remove parent theme function’ is closed to new replies.