Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: Action hook - what is wrong here?

  1. #1
    Thread Starter
    samcy's Avatar
    Join Date
    Mar 2012
    Location
    Germany
    Posts
    12,098
    Thanks
    121
    Thanked 1,756 Times in 1,442 Posts

    Unhappy Action hook - what is wrong here?

    My last try to get some help here... Maybe my other thread did not describe good enough what my problem is. So again:

    I'm sitting on a child-theme and must do a small change in the header area that shows "Ad an Post". That code is located in the /includes/theme-header.php at line 124. So far, so good. In order to get my child-theme work as i want i need an additional small code like this:

    <div class="header_menu">

    <div class="header_menu_res">

    <a href="<?php echo CP_ADD_NEW_URL ?>" class="obtn btn_orange"><?php _e('Post an Ad', 'appthemes') ?></a>

    <a href="<?php echo CP_ADD_NEW_URL ?>" class="sam_test"></a>
    The green part is the one i need to get working in my child-theme.

    Now comes my problem with the action hooks! These are the steps i did:

    I created a empty functions.php and added this code:

    PHP Code:
    <?php
    /**
     * Write your own functions or modify functions, actions, and filters using this file.
     * LIST YOUR FUNCTIONS (optional):
     * cp_import_wp_childstyle() [CUSTOM]
     * cp_get_price() [OVERWRITE]
     */

    //Place All Your Custom Function Below This Line

    //Do not place any code below this line.
    ?>
    I uploaded that functions.php to my child-theme directory. No problems so far.

    Now i would like to have my own theme-header.php which has the same content like the original + that small code from above (the green one). So i copied the complete content of the theme-header.php, added my small code in the right place and named that new file my-header.php. Now i upload this my-header.php to my main child-theme directory. So far everything ok?

    Now i add the following code to my functions.php:

    PHP Code:
    <?php
    /**
     * Write your own functions or modify functions, actions, and filters using this file.
     * LIST YOUR FUNCTIONS (optional):
     * cp_import_wp_childstyle() [CUSTOM]
     * cp_get_price() [OVERWRITE]
     */

    //Place All Your Custom Function Below This Line


    function unhook_appthemes_functions() {
      
    // unload the default ClassiPress theme header
      
    remove_action'appthemes_header''cp_header' );
    }
    add_action('init','unhook_appthemes_functions');
     
     
    // let's add our own header instead
    function my_theme_header() { 
        
    // do something here
    }
    add_action'appthemes_header''my-header' );


    //Do not place any code below this line.
    ?>
    If i call my site now, everything is ok BUT the complete header is gone - just not there. What in hell is wrong? If i make a change at the part function my_theme_header() {

    ...the site brings me a "500" Error. The word "my_theme_header" is needed? Why does it not call my my-header.php ?

    So far it seems that the functions.php is working and calling, but i must have a missunderstanding how to call my own my-header.php from there.

    Please, if somebody knows what is wrong here, give me the right way. I would really appreciate a little help.

    Samcy
    Rolf Hassel (Samcy)

  2. #2
    Senior Member cjk123's Avatar
    Join Date
    Apr 2012
    Location
    United States
    Posts
    105
    Thanks
    3
    Thanked 23 Times in 13 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  3. #3
    Thread Starter
    samcy's Avatar
    Join Date
    Mar 2012
    Location
    Germany
    Posts
    12,098
    Thanks
    121
    Thanked 1,756 Times in 1,442 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Rolf Hassel (Samcy)

  4. #4
    Senior Member cjk123's Avatar
    Join Date
    Apr 2012
    Location
    United States
    Posts
    105
    Thanks
    3
    Thanked 23 Times in 13 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  5. The Following User Says Thank You to cjk123 For This Useful Post:

    dubya (April 30th, 2012)

  6. #5
    Thread Starter
    samcy's Avatar
    Join Date
    Mar 2012
    Location
    Germany
    Posts
    12,098
    Thanks
    121
    Thanked 1,756 Times in 1,442 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Rolf Hassel (Samcy)

  7. #6
    Senior Member cjk123's Avatar
    Join Date
    Apr 2012
    Location
    United States
    Posts
    105
    Thanks
    3
    Thanked 23 Times in 13 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  8. #7
    Thread Starter
    samcy's Avatar
    Join Date
    Mar 2012
    Location
    Germany
    Posts
    12,098
    Thanks
    121
    Thanked 1,756 Times in 1,442 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Rolf Hassel (Samcy)

  9. #8
    dubya's Avatar
    Join Date
    May 2009
    Location
    Canada
    Posts
    1,000
    Thanks
    115
    Thanked 107 Times in 93 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Last edited by dubya; May 1st, 2012 at 04:49 PM. Reason: resolve error in php code provided
    The search button. Your new best friend.
    - Dubya

  10. The Following User Says Thank You to dubya For This Useful Post:

    samcy (April 30th, 2012)

  11. #9
    Senior Member cjk123's Avatar
    Join Date
    Apr 2012
    Location
    United States
    Posts
    105
    Thanks
    3
    Thanked 23 Times in 13 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  12. The Following 2 Users Say Thank You to cjk123 For This Useful Post:

    dubya (April 30th, 2012), samcy (April 30th, 2012)

  13. #10
    Senior Member cjk123's Avatar
    Join Date
    Apr 2012
    Location
    United States
    Posts
    105
    Thanks
    3
    Thanked 23 Times in 13 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

Page 1 of 3 123 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [TUTORIAL] Child Theme : Unhook ( remove hook ) default appthemes functions
    By amine0272 in forum ClassiPress General Discussion
    Replies: 9
    Last Post: August 6th, 2013, 02:42 PM
  2. Will the new 1.6 change action hooks?
    By TheSyndicate in forum JobRoller General Discussion
    Replies: 0
    Last Post: April 19th, 2012, 11:00 PM
  3. What action hooks do you want in Clipper?
    By TheSyndicate in forum Clipper General Discussion
    Replies: 0
    Last Post: March 5th, 2012, 02:19 AM
  4. post an ad << no action page?
    By deodatus in forum Help Using ClassiPress
    Replies: 1
    Last Post: May 13th, 2011, 08:36 AM