2017-02-20 7 views
0

私のシングルコースのページを再構成したいと思います(私が想定しているwoocommerceの単一の製品に匹敵します)。私は、インラインフレックスレイアウト(ライトブルーの背景)を持つコンテナを追加し、さまざまなアクションのコンテンツを追加するセクションを作成することにしました。今、私はこの親セクションにタイトルとコンテンツを追加することができましたが、ボタンを追加しようとすると、セクションの外に表示されます。私は行動を追加する手順で一貫していましたが。セクションにボタンを入れる(他の)方法はありますか?前もって感謝します!さまざまな要素の要素を1つのコンテナに追加しますが、含まれないようにします

enter image description here

add_action('sensei_single_course_content_inside_before', 'add_attributes_to_header', 20); 



    function add_attributes_to_header(){ 
    add_action('sensei_single_course_content_inside_before', open_container_div_section() ,7); 
//Opens the second container in the header bar(the one you see highlighted in the picture) 

    add_action('sensei_single_course_content_inside_before',array('Sensei_Course', add_the_title_to_header()), 50); 
    //Adds 'deel 1 - hoofdstuk 1' 

    add_action('sensei_single_course_content_inside_before',array('Sensei_Course', the_content()), 51); 
    //adds 'met een header3' and the other text below that 

    add_action('sensei_single_course_content_inside_before', add_the_button_to_header(), 52); 
    //calls seperate function to place the button, but fails to get it in the container 

    add_action('sensei_single_course_content_inside_before',array('Sensei_Course', 'the_course_enrolment_actions'), 55); 
    //THIS also adds the button, but also puts it beside the container 

    add_action('sensei_single_course_content_inside_before', close_container_div_section() ,75); 
    //Closes the section container in the header bar 
    } 

答えて

0

最後customly挿入do_action()を含有することによってそれを修正することができました。

私が呼び出す作成ヘッダー内:

add_action('sensei_single_course_content_inside_before', open_container_div_section() ,22); 

、その後:

do_action('add_elements_to_section'); 

し、最終的に:

add_action('sensei_single_course_content_inside_before', close_container_div_section() ,75); 

それから私は、このカスタムフックにアクションを追加します。

add_action('add_elements_to_section', 'add_them'); 
function add_them(){ 
    add_action('sensei_single_course_content_inside_before',array('Sensei_Course', add_the_title_to_header()), 50); 
    add_action('voeg_elementen_toe_aan_section',array('Sensei_Course', 'the_course_enrolment_actions'), 21); 
} 

完璧に作業しました!すべての要素が安全にsectionコンテナ内にあります。

関連する問題