- This topic has 7 replies, 2 voices, and was last updated 10 years, 5 months ago by Theme Horse Support Team.
-
AuthorPosts
-
June 30, 2014 at 7:50 am #11778HellenParticipant
Hi
I want to change the 404 text. So i copied the function attitude_display_404_page_content() into my child theme’s functions.php.functions.php if ( ! function_exists( 'attitude_display_404_page_content' ) ) : function attitude_display_404_page_content() { ?> ... my text... <?php } endif
then i get this error: Fatal error: Cannot redeclare attitude_display_404_page_content() in /content-extensions.php.
What am I doing wrong?
thanks in advance.
June 30, 2014 at 11:25 am #11785Theme Horse Support TeamKeymasterAfter endif semicolon is needed.
This error shows that this functions is already declared, so you are getting this error. You are not able to declare same function twice.you need to hook function too
add_action( ‘attitude_404_content’, ‘attitude_display_404_page_content’, 10 );Thank you!
June 30, 2014 at 5:14 pm #11796HellenParticipantHi,
this is my complete functions.php in the child-theme directory:
<?php // Exit if accessed directly if ( !defined('ABSPATH')) exit; /* Add custom functions below */ if ( ! function_exists( 'attitude_display_404_page_content' ) ) : add_action( 'attitude_404_content', 'attitude_display_404_page_content', 10 ); function attitude_display_404_page_content() { ?> <div id="content"> <header class="entry-header"> <h1 class="entry-title"><?php _e( 'Error 404-Page NOT Found', 'attitude' ); ?></a></h1> </header> <div class="entry-content clearfix" > <p><?php _e( 'This is my own text.', 'attitude' ); ?></p> <h3><?php _e( 'lorem ipsum', 'attitude' ); ?></h3> <h3><?php _e( 'Please try the following instead:', 'attitude' ); ?></h3> <p><?php _e( 'Check for a mis-typed URL error, then press the refresh button on your browser.', 'attitude' ); ?></p> </div><!-- .entry-content --> </div><!-- #content --> <?php } endif;
I am still getting the same error.
July 1, 2014 at 6:10 am #11802Theme Horse Support TeamKeymasteri think you don’t need this line of code
if ( ! function_exists( ‘attitude_display_404_page_content’ ) ) :endif;
thank you!
July 1, 2014 at 7:13 am #11806HellenParticipantHi,
I removed the IF-condition like you said, my functions.php now looks like this :
<?php // Exit if accessed directly if ( !defined('ABSPATH')) exit; /* Add custom functions below */ add_action( 'attitude_404_content', 'attitude_display_404_page_content', 10 ); function attitude_display_404_page_content() { ?> <div id="content"> <header class="entry-header"> <h1 class="entry-title"><?php _e( 'Error 404-Page NOT Found', 'attitude' ); ?></a></h1> </header> <div class="entry-content clearfix" > <p><?php _e( 'This is my own text.', 'attitude' ); ?></p> <h3><?php _e( 'lorem ipsum', 'attitude' ); ?></h3> <h3><?php _e( 'Please try the following instead:', 'attitude' ); ?></h3> <p><?php _e( 'Check for a mis-typed URL error, then press the refresh button on your browser.', 'attitude' ); ?></p> </div><!-- .entry-content --> </div><!-- #content --> <?php }
But i am still getting this error :
Fatal error: Cannot redeclare attitude_display_404_page_content() (previously declared in …/wp-content/themes/attitude-pro/library/structure/content-extensions.php on line 966.somehow i cannot redeclare the function???
July 2, 2014 at 11:42 am #11841Theme Horse Support TeamKeymasterUse this in your functions.php
// Unhook default Thematic functions function unhook_thematic_functions() { // Don't forget the position number if the original function has one remove_action( 'attitude_404_content', 'attitude_display_404_page_content', 10 ); } add_action('init','unhook_thematic_functions'); // removes the header content by using hook attitude_header add_action( 'attitude_404_content', 'attitude_child_display_404_page_content', 10 ); /** * function to show the footer info, copyright information */ function attitude_child_display_404_page_content() { ?> <div id="content"> <header class="entry-header"> <h1 class="entry-title"><?php _e( 'Error 404-Page NOT Found', 'attitude' ); ?></a></h1> </header> <div class="entry-content clearfix" > <p>Thank you</p> </div><!-- .entry-content --> </div><!-- #content --> <?php }
Thank you!
July 4, 2014 at 3:12 pm #11914HellenParticipantThank you very much, this was the solution that I needed!!!
kind regards!
July 5, 2014 at 2:16 pm #11929Theme Horse Support TeamKeymasterThat’s great Hellen,
Thank you!
-
AuthorPosts
- You must be logged in to reply to this topic.