Advertisement
Guest User

single-tipoftheday.php

a guest
Jan 15th, 2014
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. *
  5. * Display the Tip of the Day custom fields using
  6. * ACF.
  7. *
  8. * @author Angie Meeker
  9. * @uses Advanced Custom Fields
  10. */
  11.  
  12. // Remove Post Author
  13. add_filter( 'genesis_post_info', 'remove_post_author_totd_posts' );
  14. function remove_post_author_totd_posts($post_info) {
  15. $post_info = '[post_date]';
  16. return $post_info;
  17. }
  18.  
  19. // Return if CPT Tip of the Day
  20. add_action( 'genesis_entry_content', 'manta_tips', 11 );
  21. function manta_tips() {
  22.  
  23. // Store the tips data
  24. $tips_data = array(
  25. 'totd_tags' => get_field( 'totd_tags' ),
  26. 'tip_article_headline' => get_field( 'tip_article_headline' ),
  27. 'article_author' => get_field( 'article_author' ),
  28. 'article_author_link' => get_field( 'article_author_link' ),
  29. 'article_snippet' => get_field( 'article_snippet' ),
  30. 'weigh_in' => get_field( 'weigh_in' ),
  31. );
  32.  
  33.  
  34. // Only output if we have tips data
  35. if ($tips_data['totd_tags'] != '' ||
  36. $tips_data['tip_article_headline'] != '' ||
  37. $tips_data['article_author'] != '' ||
  38. $tips_data['article_author_link'] != '' ||
  39. $tips_data['article_snippet'] != '' ||
  40. $tips_data['weigh_in'] != '' ) {
  41. echo '<h6>RELATED ARTICLE</h6>';
  42. echo '<div class="entry-content">';
  43. if ( $tips_data['tip_article_headline'] ) {
  44. echo '<div class="totd-h2">' . esc_attr( $tips_data['tip_article_headline'] ) . '</div>';
  45. }
  46.  
  47. if ( $tips_data['article_author_link'] ) {
  48. echo '<div class="entry-content">By <a href="' . esc_url( $tips_data['article_author_link'] ) . '">' . esc_attr( $tips_data['article_author'] ) . '</a></div>';
  49. }
  50. if ( $tips_data['article_snippet'] ) {
  51. echo '<div class="entry-content">' . esc_attr( $tips_data['article_snippet'] ) . '</div>';
  52. }
  53. if ( $tips_data['weigh_in'] ) {
  54. echo '<div class="totd-h2"><H6>WEIGH IN</H6>' . esc_attr( $tips_data['weigh_in'] ) . '</div>';
  55. }
  56. echo '</div>';
  57. }
  58. }
  59.  
  60.  
  61. genesis();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement