Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Forum: Fixing WordPress
    In reply to: PHP in WordPress

    depends on the how your theme is build.
    you could hook it into your wp_head action to achieve that..
    wp_head action is mostly located in your header.php file.
    if there is no wp_head action , just add wp_head(); function into your header file.

    example on how to hook into your wp_head action:

    function test(){
        echo "hello from inside the test action";
    }
    
    add_action('wp_head', 'test', 10);

    you could also create your own actions anywhere you desire.

    example:
    1. add a action into your header or any theme file as:
    do_action("your_action_name");

    2. crate a function in your function.php file and use add_action to hook the function into your action as:

    //create a function
    function myFunc(){
        #your code, for example
        echo "hello from inside my function";
    }
    
    //add action
    add_action('your_action_name', 'myFunc', 10);
    
    //add_action() function hooks into your action and prints the function code on the page where your do_action() is located

    this article explains more on how to create and use actions:
    http://codex.ww.wp.xz.cn/Function_Reference/do_action

    I don’t know much about thesis, but normally you could do something like editing your header.php file…

    you could try something like this:

    if ( is_home() ) {
        #here goes your header  eg. content you'd like to be displayed only
        on homepage...
    }
Viewing 2 replies - 1 through 2 (of 2 total)