Some basic hooks of Flatsome part 1 – Learn WordPress from a to z

Tutorials 0 lượt xem
Some basic hooks of Flatsome part 1 - Learn Wordpress from a to z thumbnail

Built and developed by leading experts, Flatsome has a very professional and modern design.

That’s why the need to edit Flatsome is very much, requiring you to have certain knowledge of the basic hook of Flatsome.

1. Hook is located in the header of Flatsome

In the header of Flatsome there is a hook named

  • In front of the Header is: flatsome_before_header.
  • Behind the Header is: flatsome_after_header.

Here is an example, you will understand part of it. I write in the functions.php file:

function topheader(){
    echo “<p style=’text-align:center’>Welcome to Learn WordPress</p>”;
}
add_action(‘flatsome_before_header’,’topheader’);
function bottomheader(){
    echo “<p style=’text-align:center’>Admin Learn WordPress</p>”;
}
add_action(‘flatsome_after_header’,’bottomheader’)

and here is the image:

hook header flatsome

Similar to the header are the hooks:

flatsome_after_header,flatsome_before_footer I won’t repeat it again.

3.Hook woocommerce_product_description_heading

This code helps you to add product description in woocommerce.

function add_heading_custom($heading){
    return $heading = ‘This is the description ‘;
}
add_filter(‘woocommerce_product_description_heading’,’add_heading_custom’,100);
hook des flatsome

4.Hook flatsome_before_product_page

This hook will show up right after the product’s “main” opening tag.
function add_text_flatsome_before_product_page(){
    echo ‘<div class=”row”> This hook will be displayed right after the opening “main” tag of the product.</div>’;
}
add_action(‘flatsome_before_product_page’,’add_text_flatsome_before_product_page’);
hook prodcut flatsome

5.Hook flatsome_after_product_page

This hook will show up right after the product’s “main” closing tag.

function add_text_flatsome_after_product_page(){

    echo ‘<div class=”row”> This hook will be displayed right after the opening “main” tag of the product.</div>’;
}
add_action(‘flatsome_after_product_page’,’add_text_flatsome_after_product_page’);

Epilogue

Hoping for a tutorial on how to use Flatsome’s basic hooks.

If you find it interesting, you can follow the  wordpress tips section  to know more new knowledge.

Follow fanpage to receive the latest posts:  Group

Wish you have interesting and interesting knowledge about wordpress!

Bài viết liên quan