Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * Display the Tip of the Day custom fields using
- * ACF.
- *
- * @author Angie Meeker
- * @uses Advanced Custom Fields
- */
- // Remove Post Author
- add_filter( 'genesis_post_info', 'remove_post_author_totd_posts' );
- function remove_post_author_totd_posts($post_info) {
- $post_info = '[post_date]';
- return $post_info;
- }
- // Return if CPT Tip of the Day
- add_action( 'genesis_entry_content', 'manta_tips', 11 );
- function manta_tips() {
- // Store the tips data
- $tips_data = array(
- 'totd_tags' => get_field( 'totd_tags' ),
- 'tip_article_headline' => get_field( 'tip_article_headline' ),
- 'article_author' => get_field( 'article_author' ),
- 'article_author_link' => get_field( 'article_author_link' ),
- 'article_snippet' => get_field( 'article_snippet' ),
- 'weigh_in' => get_field( 'weigh_in' ),
- );
- // Only output if we have tips data
- if ($tips_data['totd_tags'] != '' ||
- $tips_data['tip_article_headline'] != '' ||
- $tips_data['article_author'] != '' ||
- $tips_data['article_author_link'] != '' ||
- $tips_data['article_snippet'] != '' ||
- $tips_data['weigh_in'] != '' ) {
- echo '<h6>RELATED ARTICLE</h6>';
- echo '<div class="entry-content">';
- if ( $tips_data['tip_article_headline'] ) {
- echo '<div class="totd-h2">' . esc_attr( $tips_data['tip_article_headline'] ) . '</div>';
- }
- if ( $tips_data['article_author_link'] ) {
- echo '<div class="entry-content">By <a href="' . esc_url( $tips_data['article_author_link'] ) . '">' . esc_attr( $tips_data['article_author'] ) . '</a></div>';
- }
- if ( $tips_data['article_snippet'] ) {
- echo '<div class="entry-content">' . esc_attr( $tips_data['article_snippet'] ) . '</div>';
- }
- if ( $tips_data['weigh_in'] ) {
- echo '<div class="totd-h2"><H6>WEIGH IN</H6>' . esc_attr( $tips_data['weigh_in'] ) . '</div>';
- }
- echo '</div>';
- }
- }
- genesis();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement