Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. <?php
  2.  
  3. $the_slug = get_query_var('pid');
  4.  
  5. if ($the_slug){
  6.  
  7. if ( $post = get_page_by_path( $the_slug, OBJECT, 'myposttype' ) )
  8. $id = $post->ID;
  9. else
  10. $id = 0;
  11. ?>
  12.  
  13. <?php get_header(); ?>
  14. <div class="warpper">
  15.  
  16.  
  17.  
  18. <?php ;
  19. $args = array(
  20. 'name' => $the_slug,
  21. 'post_type' => 'myposttype',
  22. 'post_status' => 'publish',
  23. 'numberposts' => 1,
  24. );
  25. $query = new WP_Query( $args );
  26. if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?>
  27.  
  28. <?php the_title(); ?>
  29.  
  30. <?php endwhile; else: ?><?php endif; ?>
  31. <php } else{...};
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement