Advertisement
fahimmurshed

Astra Blog/Page Title Tags

Apr 10th, 2020
574
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1. add_action( 'wp', 'astra_add_title_filter' );
  2.  
  3. /**
  4. * Function to add filters to change titles.
  5. *
  6. * @return void
  7. */
  8. function astra_add_title_filter() {
  9.     add_filter( 'astra_the_title_before', 'astra_the_title_before_tag', 1, 10 );
  10.     add_filter( 'astra_the_title_after', 'astra_the_title_after_tag', 1, 10 );
  11. }
  12.  
  13. /**
  14. * Function to change tag in all titles.
  15. *
  16. * @param string $tag This contains default tag used for the titles.
  17. * @return string
  18. */
  19. function astra_the_title_before_tag( $tag ) {
  20.     $tag = '<h1>';
  21.     return $tag;
  22. }
  23.  
  24. /**
  25. * Function to change tag in all titles.
  26. *
  27. * @param string $tag This contains default tag used for the titles.
  28. * @return string
  29. */
  30. function astra_the_title_after_tag( $tag ) {
  31.     $tag = '</h1>';
  32.     return $tag;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement