Guest User

Untitled

a guest
Jul 14th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. <?php
  2. /**
  3. * This file loads the content when called.
  4. *
  5. * @version 1.4.8
  6. */
  7.  
  8. $template_location = apply_filters('alnp_template_location', ''); // e.g. "template-parts/post/"
  9.  
  10. if ( have_posts() ) :
  11.  
  12. // Load content before the loop.
  13. do_action('alnp_load_before_loop');
  14.  
  15. // Check that there are posts to load.
  16. while (have_posts()) : the_post();
  17.  
  18. $post_format = get_post_format(); // Post Format e.g. video
  19.  
  20. // Load content before the post content.
  21. do_action('alnp_load_before_content');
  22.  
  23. // Load content before the post content for a specific post format.
  24. do_action('alnp_load_before_content_type_'.$post_format);
  25.  
  26. if (false === $post_format) {
  27. // Include the standard content.php file.
  28. get_template_part($template_location . 'content');
  29. } else {
  30. // Include the post format content.
  31. if (locate_template($template_location . 'format-'.$post_format.'.php') != '') {
  32. get_template_part($template_location . 'format', $post_format);
  33. } else {
  34. // If no format-{post-format}.php file found then fallback to content-{post-format}.php
  35. get_template_part($template_location . 'content', $post_format);
  36. }
  37. }
  38.  
  39. // Load content after the post content for a specific post format.
  40. do_action('alnp_load_after_content_type_'.$post_format);
  41.  
  42. // Load content after the post content.
  43. do_action('alnp_load_after_content');
  44.  
  45. // End the loop.
  46. endwhile;
  47.  
  48. // Load content after the loop.
  49. do_action('alnp_load_after_loop');
  50.  
  51. else :
  52.  
  53. // Load content if there are no more posts.
  54. do_action('alnp_no_more_posts');
  55.  
  56. endif; // END if have_posts()
Add Comment
Please, Sign In to add comment