Last active
August 29, 2015 14:22
-
-
Save DMSpeed/e92d09beec8c77e7e507 to your computer and use it in GitHub Desktop.
Gets fields from a specific list of pages and displays them in a page template for the Genesis framework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Brazosport Chamber | |
* Description: This page pulls links from other pages on the site and displays them in one list. | |
* @package Brazosport Chamber | |
* @author Dorian Speed, Up to Speed | |
* @license GPL-2.0+ | |
*/ | |
//* Template Name: Consolidated Links | |
//* Remove the post info function | |
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); | |
//* Remove the author box | |
remove_action( 'genesis_after_entry', 'genesis_do_author_box', 8 ); | |
add_action( 'genesis_entry_content', 'brazosport_display_local_links', 10 ); | |
function brazosport_display_local_links() { | |
$pagenumber = array (3329, 3331, 3334, 3338); | |
foreach ($pagenumber as $value) { | |
if ( have_rows( 'brazosport_local_links', $value ) ) { | |
echo '<h2>' . get_the_title( $value ) . '</h2>'; | |
echo '<ul>'; | |
while ( have_rows( 'brazosport_local_links', $value ) ) : the_row(); | |
$label = get_sub_field( 'brazosport_local_link_label', $value); | |
$phone = get_sub_field( 'brazosport_local_link_phone', $value); | |
$website = get_sub_field( 'brazosport_local_link_url', $value ); | |
echo '<li><strong>' . $label . ':</strong> '; | |
if ($phone) { | |
echo '<a href="tel:+' . $phone . '"><i class="fa fa-phone-square fa-fw"></i> ' . $phone . '</a>'; | |
} | |
if ($website) { | |
echo '<a href="' . esc_url($website) . '">' . esc_url($website) . '</a>'; | |
} | |
endwhile; | |
echo '</ul>'; | |
} | |
} | |
} | |
//* Remove the post meta function | |
remove_action( 'genesis_entry_footer', 'genesis_post_meta' ); | |
genesis(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment