Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. $alltags= array();
  2.  
  3. $args = array(
  4. 'order' => 'ASC',
  5. 'orderby' => 'menu_order',
  6. 'hierarchical' => 1,
  7. 'exclude' => '',
  8. 'include' => '',
  9. 'meta_key' => '',
  10. 'meta_value' => '',
  11. 'authors' => '',
  12. 'child_of' => 0,
  13. 'parent' => $id,
  14. 'exclude_tree' => '',
  15. 'number' => '',
  16. 'offset' => 0,
  17. 'post_type' => 'page',
  18. 'post_status' => 'publish',
  19. 'cat' => 399,
  20. 'posts_per_page' =>100,
  21. );
  22.  
  23. $query = new WP_Query( $args );
  24.  
  25. $pages = $query->posts;
  26.  
  27. foreach($pages as $page) {
  28.  
  29. // echo "<pre>";
  30. //print_r($page);
  31. //echo "</pre>";
  32.  
  33. //$meta = get_post_meta($page->ID, '', true);
  34.  
  35. $tags = wp_get_post_tags($page->ID);
  36.  
  37. if ($tags) {
  38.  
  39. foreach ($tags as $tag) {
  40.  
  41. // $tag->name = str_replace('&', "", $tag->name);
  42.  
  43. array_push($alltags, $tag->name);
  44.  
  45. }
  46. }
  47.  
  48.  
  49.  
  50. }
  51.  
  52. $uniquetag = array_unique($alltags);
  53. asort($uniquetag);
  54. array_unshift($uniquetag , 'All');
  55. echo "<pre>";
  56. print_r($uniquetag);
  57. echo "</pre>";
  58. ?>
  59. <div class="row">
  60. <div class="toolbar mb2 mt2">
  61. <?php
  62. if($uniquetag){
  63. foreach ($uniquetag as $key => $value) { if($value =='Addhomeportfolio') { }
  64. else {
  65. ?>
  66. <button class="btn fil-cat" data-rel="<?php $string = str_replace(' ', '', $value); echo $string = str_replace('&', "", $string); ?>"><?php echo $value; ?></button>
  67. <?php
  68. } }
  69. }
  70. ?>
  71. </div>
  72. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement