chore: indenting

This commit is contained in:
Ben Goldsworthy 2022-04-12 22:34:33 +01:00
parent 2f3ed12adf
commit a9c17dbfc2
6 changed files with 72 additions and 75 deletions

View File

@ -12,21 +12,21 @@
<?php $loop = new WP_Query( $args ); ?> <?php $loop = new WP_Query( $args ); ?>
<header class="entry-content tile location-block"> <header class="entry-content tile location-block">
<div class="post-header-title"> <div class="post-header-title">
<h1 id="page-title">Experience</h1> <h1 id="page-title">Experience</h1>
<h2 id="page-subtitle">by location</h2> <h2 id="page-subtitle">by location</h2>
<?php <?php
while ( have_posts() ) : while ( have_posts() ) :
the_post(); the_post();
?> ?>
<div class="entry-content" id="taxonomy-description"> <div class="entry-content" id="taxonomy-description">
<?php the_content(); ?> <?php the_content(); ?>
<div> <div>
<a class="hyperlink-button" href="?view=countries">Countries</a> <a class="hyperlink-button" href="?view=countries">Countries</a>
<!--<a class="hyperlink-button" href="?view=regions">Regions</a>--> <!--<a class="hyperlink-button" href="?view=regions">Regions</a>-->
<a class="hyperlink-button" href="?view=locations">Locations</a> <a class="hyperlink-button" href="?view=locations">Locations</a>
</div> </div>
</div> </div>
<?php endwhile; ?> <?php endwhile; ?>
</div> </div>
</header> </header>
@ -43,10 +43,10 @@ $terms = get_terms(
<div id="primary" class="content-area"> <div id="primary" class="content-area">
<main id="company-main" class="site-main" role="main"> <main id="company-main" class="site-main" role="main">
<div class="row"> <div class="row">
<div id="map" style="height:100vh; width:100%;"></div> <div id="map" style="height:100vh; width:100%;"></div>
</div> </div>
<?php if ( ! empty( $locations ) ) : ?> <?php if ( ! empty( $locations ) ) : ?>
<?php if ( $_GET['view'] == 'countries' ) : ?> <?php if ( $_GET['view'] == 'countries' ) : ?>
<?php <?php
$locationsSubset = array_filter( $locationsSubset = array_filter(
@ -58,24 +58,24 @@ $terms = get_terms(
?> ?>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript"> <script type="text/javascript">
google.charts.load('current', {'packages':['geochart']}); google.charts.load('current', {'packages':['geochart']});
google.charts.setOnLoadCallback(drawMap); google.charts.setOnLoadCallback(drawMap);
function drawMap() { function drawMap() {
var data = google.visualization.arrayToDataTable([ var data = google.visualization.arrayToDataTable([
['Country'], ['Country'],
<?php foreach ( (array) $locationsSubset as $term ) : ?> <?php foreach ( (array) $locationsSubset as $term ) : ?>
['<?php echo $term->description; ?>'], ['<?php echo $term->description; ?>'],
<?php endforeach; ?> <?php endforeach; ?>
]); ]);
var options = {}; var options = {};
var chart = new google.visualization.GeoChart(document.getElementById('map')); var chart = new google.visualization.GeoChart(document.getElementById('map'));
chart.draw(data, options); chart.draw(data, options);
} }
</script> </script>
<?php elseif ( $_GET['view'] == 'locations' ) : ?> <?php elseif ( $_GET['view'] == 'locations' ) : ?>
<?php <?php
$locationsSubset = array_filter( $locationsSubset = array_filter(
$locations, $locations,
function ( $t ) { function ( $t ) {
@ -84,42 +84,42 @@ $terms = get_terms(
); );
?> ?>
<script type="text/javascript"> <script type="text/javascript">
var locations = [ var locations = [
<?php foreach ( (array) $locationsSubset as $term ) : ?> <?php foreach ( (array) $locationsSubset as $term ) : ?>
{<?php echo $term->description; ?>}, {<?php echo $term->description; ?>},
<?php endforeach; ?> <?php endforeach; ?>
] ]
function initMap() { function initMap() {
var map = new google.maps.Map(document.getElementById('map'), { var map = new google.maps.Map(document.getElementById('map'), {
zoom: 3, zoom: 3,
center: {lat: 51.483462, lng: 0.0586198} center: {lat: 51.483462, lng: 0.0586198}
}); });
// Create an array of alphabetical characters used to label the markers. // Create an array of alphabetical characters used to label the markers.
var labels = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; var labels = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
// Add some markers to the map. // Add some markers to the map.
// Note: The code uses the JavaScript Array.prototype.map() method to // Note: The code uses the JavaScript Array.prototype.map() method to
// create an array of markers based on a given "locations" array. // create an array of markers based on a given "locations" array.
// The map() method here has nothing to do with the Google Maps API. // The map() method here has nothing to do with the Google Maps API.
var markers = locations.map(function(location, i) { var markers = locations.map(function(location, i) {
return new google.maps.Marker({ return new google.maps.Marker({
position: location, position: location,
label: labels[i % labels.length] label: labels[i % labels.length]
}); });
}); });
// Add a marker clusterer to manage the markers. // Add a marker clusterer to manage the markers.
var markerCluster = new MarkerClusterer(map, markers, { var markerCluster = new MarkerClusterer(map, markers, {
imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m' imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'
}); });
} }
</script> </script>
<script src="https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/markerclusterer.js"></script> <script src="https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/markerclusterer.js"></script>
<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBsMPnuCM59sC_n11CGxbpbqNY7FRUXnD0&callback=initMap"></script> <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBsMPnuCM59sC_n11CGxbpbqNY7FRUXnD0&callback=initMap"></script>
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>
</main><!-- .site-main --> </main><!-- .site-main -->
</div><!-- .content-area --> </div><!-- .content-area -->

View File

@ -23,10 +23,10 @@ get_header(); ?>
the_post(); the_post();
/** /**
* Run the loop for the search to output the results. * Run the loop for the search to output the results.
* If you want to overload this in a child theme then include a file * If you want to overload this in a child theme then include a file
* called content-search.php and that will be used instead. * called content-search.php and that will be used instead.
*/ */
get_template_part( 'template-parts/content', 'search' ); get_template_part( 'template-parts/content', 'search' );
// End the loop. // End the loop.

View File

@ -8,11 +8,7 @@
?> ?>
<footer id="site-footer" class="show"> <footer id="site-footer" class="show">
<p>By <a href="/">Ben</a> | <p>By <a href="/">Ben</a> | <?php if ( ! is_page('Hi.') && ! is_page('privacy-policy') && ! is_404() ): ?><a href="https://github.com/Rumperuu/Omphaloskepsis/issues" target="_blank" rel="noopener noreferrer">Report an Issue</a> | <?php endif; ?><a href="/privacy-policy">Privacy Policy</a></p>
<?php
if ( ! is_page( 'Hi.' ) && ! is_page( 'privacy-policy' ) && ! is_404() ) :
?>
<a href="https://github.com/Rumperuu/Omphaloskepsis/issues" target="_blank" rel="noopener noreferrer">Report an Issue</a> | <?php endif; ?><a href="/privacy-policy">Privacy Policy</a></p>
</footer> </footer>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -591,7 +591,8 @@ function display_companies() {
); );
$include = 0; $include = 0;
} }
// phpcs:enable
// phpcs:enable
if ( ! empty( $terms ) ) { if ( ! empty( $terms ) ) {
foreach ( $terms as $term ) { foreach ( $terms as $term ) {
$term_children = get_term_children( $term->term_id, 'company' ); $term_children = get_term_children( $term->term_id, 'company' );

View File

@ -14,9 +14,9 @@
<?php <?php
$subtitle = get_post_meta( get_the_ID(), 'Subtitle', true ); $subtitle = get_post_meta( get_the_ID(), 'Subtitle', true );
if ( $subtitle ) : if ( $subtitle ) :
?> ?>
: <?php echo wp_kses_post( $subtitle ); ?> : <?php echo wp_kses_post( $subtitle ); ?>
<?php <?php
endif; endif;
?> ?>
</a> </a>

View File

@ -21,7 +21,7 @@
<a class="item" href="<?php echo esc_url( $post_link ); ?>"<?php echo ( $links_externally ) ? ' target="_blank" rel="noopener noreferrer"' : ''; ?>> <a class="item" href="<?php echo esc_url( $post_link ); ?>"<?php echo ( $links_externally ) ? ' target="_blank" rel="noopener noreferrer"' : ''; ?>>
<article id="post-<?php the_ID(); ?>" class="tile col-m-6 col-4 col-w-3" style="background-image: url('<?php the_post_thumbnail_url(); ?>');"> <article id="post-<?php the_ID(); ?>" class="tile col-m-6 col-4 col-w-3" style="background-image: url('<?php the_post_thumbnail_url(); ?>');">
<?php <?php
$title_length = strlen( get_the_title() ); $title_length = strlen(get_the_title());
if ( $title_length > 70 ) { if ( $title_length > 70 ) {
$small = 'vsmall'; $small = 'vsmall';
} elseif ( $title_length > 35 ) { } elseif ( $title_length > 35 ) {
@ -51,9 +51,9 @@
<?php <?php
$subtitle = get_post_meta( get_the_ID(), 'Subtitle', true ); $subtitle = get_post_meta( get_the_ID(), 'Subtitle', true );
if ( $subtitle ) : if ( $subtitle ) :
?> ?>
<h2> <h2>
<?php echo wp_kses_post( $subtitle ); ?> <?php echo wp_kses_post( $subtitle ); ?>
</h2> </h2>
<?php endif; ?> <?php endif; ?>