Advertisement
pusatdata

WP: Tags in Pages

Feb 28th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. Untuk memunculkan kolom tags di admin, paste this code in function.php
  2.  
  3. // add tag support to pages
  4. function tags_support_all() {
  5. register_taxonomy_for_object_type('post_tag', 'page');
  6. }
  7.  
  8. // ensure all tags are included in queries
  9. function tags_support_query($wp_query) {
  10. if ($wp_query->get('tag')) $wp_query->set('post_type', 'any');
  11. }
  12.  
  13. // tag hooks
  14. add_action('init', 'tags_support_all');
  15. add_action('pre_get_posts', 'tags_support_query');
  16.  
  17. Untuk memunculkan di halaman page, cari kode tags di single.php lalu copy dan paste kode tsb di page.php.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement