Guest User

Untitled

a guest
Jan 20th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. foreach( $related_posts as $post_type => $post_type_related_posts ) {
  2. # This filters %posttype% from the title
  3. $title = MRP_get_title( __($options['title'], 'microkids-related-posts'), $post_type );
  4. if( count( $post_type_related_posts ) ) {
  5. $output .= "<div id="related-posts-$post_type" class="related-posts-type">n";
  6. # Create the title with the selected HTML header
  7. $output .= "<".$options['header_element'].">".$title."</".$options['header_element'].">n";
  8. $output .= "<ul>n";
  9. # Add related posts
  10. foreach( $post_type_related_posts as $related_post ) {
  11. $output .= "<li>";
  12. $output .= "<a href="".get_permalink( $related_post->ID )."">".$related_post->post_title."</a>";
  13. $output .= "</li>n";
  14. }
  15. $output .= "</ul></div>n";
  16. }
  17. # If there are no related posts for this post type
  18. else {
  19. if( !$options['hide_if_empty'] ) {
  20. $output .= "<div id="related-posts-$post_type" class="related-posts-type">n";
  21. $output .= "<".$options['header_element'].">".$title."</".$options['header_element'].">n";
  22. $output .= "<p>".$options['text_if_empty']."</p>n";
  23. $output .= "</div>";
  24. }
  25. else {
  26. # Show nothing
  27. return "";
  28. }
  29. }
  30. }
  31. $output .= "</div>";
  32. return $output;
  33.  
  34. $output .= "<a href="".get_permalink( $related_post->ID ."">".$related_post->post_title."</a>";
  35.  
  36. $output .= "<a class=" THE-CATEGORY-SLUG " href="".get_permalink( $related_post->ID )."">".$related_post->post_title."</a>";
  37.  
  38. foreach((get_the_category( $related_post->ID )) as $category) {
  39. $output .= "<a class="$category->slug" href="".get_permalink( $related_post->ID )."" title="" . $category->cat_name . "">" . $category->cat_name . "</a>";
  40. }
  41.  
  42. $output .= "<a href="".get_permalink( $related_post->ID )."">".$related_post->post_title."</a>";
  43.  
  44. $output .= get_post_field('post_content', $related_post->ID);
Add Comment
Please, Sign In to add comment