Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
various fixes
  • Loading branch information
jjc16105 committed Sep 8, 2016
1 parent 1c91e78 commit a026959
Show file tree
Hide file tree
Showing 2 changed files with 155 additions and 75 deletions.
76 changes: 1 addition & 75 deletions functions.php
Expand Up @@ -263,78 +263,4 @@ function uc_redirect_403() {
}

add_action( 'template_redirect', 'uc_redirect_403' );


//====================================================
// WordPress Link Guessing Option adds a checkbox
// to the Settings page
//====================================================

add_action( 'admin_init', 'link_guessing_settings_init' );

//====================================================
// Link Guessing - ON or OFF ?
//====================================================

add_action( 'wp_loaded', function ()
{
$checked = get_option( 'link_guessing' );
if ( empty( $checked ) ){
remove_filter('template_redirect', 'redirect_canonical');
}else{
add_filter('template_redirect', 'redirect_canonical');
}
});

//====================================================
// Link Guessing init
//====================================================

function link_guessing_settings_init(){

/* Register Settings */
register_setting(
'general', // Options group
'link_guessing', // Option name/database
'link_guessing_sanitize' // sanitize callback function
);

/* Create settings section */
add_settings_section(
'link_guessing_section_id', // Section ID
'', // Section title - leave it blank
null, // Section description callback function - we don't need it
'general' // Settings page slug
);

/* Create settings field */
add_settings_field(
'link_guessing_field_id', // Field ID
'Link Guessing', // Field title
'link_guessing_field_callback', // Field callback function
'general', // Settings page slug
'link_guessing_section_id' // Section ID
);
}

//====================================================
/* Sanitize Callback Function */
//====================================================

function link_guessing_sanitize( $input ){
return isset( $input ) ? true : false;
}

//====================================================
/* Settings Field Callback */
//====================================================

function link_guessing_field_callback(){
?>
<label for="link_guessing">
<?php
$checked = get_option( 'link_guessing' );
?>
<input id="link_guessing" type="checkbox" name="link_guessing" <?php checked($checked) ?>> Check to enable Wordpress link guessing
</label>
<?php } ?>
?>
154 changes: 154 additions & 0 deletions inc/people-grid.php
@@ -0,0 +1,154 @@
<?php
$the_query = new WP_Query( $args );

if ( $the_query->have_posts() ) { ?>
<div class="row">
<?php

//global $post;
//var_dump($post);
//echo "<br />";

$person_count = 1;

while ( $the_query->have_posts() ) {
$the_query->the_post();

/*$persons_per_row = get_field( 'persons_per_row' );
if( empty($persons_per_row) ){
$persons_per_row = 4; // default is 4
}
*/
?>


<?php // 12/$persons_per_row ?>
<div class="col-sm-<?php echo 12/$persons_per_row; ?> personcount-<?php echo $person_count ?>" id="person-<?php echo get_the_id(); ?>">
<div class="person">
<?php
$external_url = get_field('external_url');
if ( $external_url != "" ){
echo '<a href="'. $external_url .'" class="person-permalink" target="_blank">';
}else{
echo '<a href="'. get_the_permalink().'" class="person-permalink">';
}
if (in_array('photo', $information_to_display)) {
echo '<div class="person-image">';
the_post_thumbnail('large');
echo '</div>';
};

if (in_array('first_name', $information_to_display) || in_array('middle_name', $information_to_display) || in_array('last_name', $information_to_display)){
echo '<h4 class="person-name">';
if (in_array('first_name', $information_to_display)) {
the_field('first_name');
echo ' ';
};
if (in_array('middle_name', $information_to_display)) {
the_field('middle_name');
echo ' ';
};
if (in_array('last_name', $information_to_display)) {
the_field('last_name');
};
echo '</h4>';
};

echo '</a>';

if (in_array('title', $information_to_display)) {
echo '<p class="person-title">';
$titlePieces = explode(";", get_field('title'));
foreach( $titlePieces as $t ){
echo ( !empty($t) ? "<strong>{$t}</strong><br>": "" );
}
echo '</p>';
};
if (in_array('department', $information_to_display)) {
echo '<p class="person-department">';
$departmentPieces = explode(";", get_field('department'));
foreach( $departmentPieces as $d ){
echo ( !empty($d) ? "<strong>{$d}</strong><br>": "" );
}
echo '</p>';
};
if (in_array('about', $information_to_display)) {
echo '<div class="person-about">';
the_field('about');
echo '</div>';
};
if (in_array('file', $information_to_display)) {
$file = get_field('file');
$urlLength = strlen($file['url']);
if ($urlLength > 0){
echo '<p class="person-file">';
echo '<a href="'.$file['url'].'">'.$file['title'].'</a>';
echo '</p>';
}
};
if (in_array('email', $information_to_display)) {
echo '<p class="person-email">';
echo '<a href="mailto:'.get_field('email').'">'.get_field('email').'</a>';
echo '</p>';
};
if (in_array('phone', $information_to_display)) {
echo '<p class="person-phone">';
the_field('phone');
echo '</p>';
};
if (in_array('phone_(alternate)', $information_to_display)) {
echo '<p class="person-phone_(alternate)">';
the_field('phone_(alternate)');
echo '</p>';
};
if (in_array('fax', $information_to_display)) {
echo '<p class="person-fax">';
the_field('fax');
echo '</p>';
};
if (in_array('mailing_address', $information_to_display)) {
echo '<p class="person-mailing_address">';
echo str_replace(';','<br>',get_field('mailing_address'));
echo '</p>';
};
if (in_array('office_location', $information_to_display)) {
echo '<p class="person-office_location">';
the_field('office_location');
echo '</p>';
};
if (in_array('campus', $information_to_display)) {
echo '<p class="person-campus">';
the_field('campus');
echo '</p>';
};
if (in_array('office_hours', $information_to_display)) {
echo '<p class="person-office_hours">';
the_field('office_hours');
echo '</p>';
};
if (in_array('courses', $information_to_display)) {
echo '<p class="person-courses">';
the_field('courses');
echo '</p>';
};
if (in_array('url', $information_to_display)) {
echo '<p class="person-url"><a href="'.get_field('url').'">'.get_field('url').'</a></p>';
}; ?>
</div><!-- /person -->
</div> <!-- /col -->

<?php
// check to see if we need to close this row...
//if ($person_count % $persons_per_row == 0){
if ( $person_count % $persons_per_row == 0 ){
// if this is the 4th, 8th, 16th, etc person...
echo '</div><!-- /row --><div class="row">';
}
$person_count++;
} //end of posts?>
</div><!-- last row -->
<?php
} else {
// no posts found
}; ?>

0 comments on commit a026959

Please sign in to comment.