Skip to content

Commit

Permalink
Merge pull request #7 from choctaw-nation/2.1.0
Browse files Browse the repository at this point in the history
fixes #6 and bug fixes
  • Loading branch information
kjroelke authored Nov 6, 2023
2 parents 0c4080e + 68db777 commit bb53358
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 17 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ A WordPress Plugin for Event Displays.

# Changelog

## v2.1.0

- Registers standard archive & single images sizes

## v2.0.5

- Update AddToCalendar logic to be registered immediately and enqueud in the `single` file.
Expand Down
10 changes: 5 additions & 5 deletions inc/acf/objects/class-choctaw-event.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,13 @@ private function set_the_date_times( array $date_time ) {
* Gets the linked Venue tax and assigns it to the event property
*/
private function set_the_venue() {
$this->venue = null;
if ( taxonomy_exists( 'choctaw-events-venue' ) ) {
require_once __DIR__ . '/class-event-venue.php';
$venue = get_the_terms( $this->event_id, 'choctaw-events-venue' );
$this->venue = new Event_Venue( $venue[0] );

} else {
$this->venue = null;
$venue = get_the_terms( $this->event_id, 'choctaw-events-venue' );
if ( $venue ) {
$this->venue = new Event_Venue( $venue[0] );
}
}
}

Expand Down
12 changes: 8 additions & 4 deletions inc/class-plugin-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ public function __construct( string $cpt_slug = 'choctaw-events', string $rewrit
add_action( 'wp_enqueue_scripts', array( $this, 'add_to_calendar_js' ) );
include_once __DIR__ . '/acf/objects/class-event-venue.php';
// register_activation_hook( dirname( __DIR__ ) . '/index.php', array( $this, 'activate_plugin' ) );
add_action( 'after_setup_theme', array( $this, 'register_image_sizes' ) );
}


/**
* Filter the WordPress Template Lookup to view the Plugin folder first
*
* @param string $template the template path
*/
public function update_template_loader( string $template ): string {
$is_single = is_singular( 'choctaw-events' );
$is_archive = is_archive( 'choctaw-events' );
$is_archive = is_post_type_archive( 'choctaw-events' );
// $is_search = is_search();
if ( $is_single ) {
$template = $this->get_the_template( 'single' );
Expand Down Expand Up @@ -67,8 +67,6 @@ private function get_the_template( string $type ): string|\WP_Error {
}
}



/**
* Returns the Plugin Archive.php Path (if exists)
*/
Expand Down Expand Up @@ -104,4 +102,10 @@ public function enqueue_search_tsx() {
array( 'strategy' => 'defer' )
);
}

/** Registers image sizes for Single and Archive pages */
public function register_image_sizes() {
add_image_size( 'choctaw-events-preview', 1392, 784 );
add_image_size( 'choctaw-events-single', 2592, 1458 );
}
}
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Plugin Name: Choctaw Events Plugin
* Description: Choctaw Events Plugin creates the Events and displays them in a nice way.
* Version: 2.0.5
* Version: 2.1.0
* Author: Choctaw Nation of Oklahoma
* Author URI: https://www.choctawnation.com
* Text Domain: cno
Expand Down
4 changes: 2 additions & 2 deletions template-parts/archive/content-event-preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<div class="col">
<div class="row flex-row-reverse">
<div class="col-lg-4">
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail(); ?>
<a href="<?php the_permalink(); ?>" class="ratio ratio-16x9">
<?php the_post_thumbnail( 'choctaw-events-preview', array( 'class' => 'object-fit-cover' ) ); ?>
</a>
</div>
<div class="col-lg-8 post-preview my-3 my-lg-0">
Expand Down
12 changes: 7 additions & 5 deletions templates/single-choctaw-events.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@
</ol>
</nav>
<article <?php post_class(); ?> id="<?php echo 'post-' . get_the_ID(); ?>">
<header>
<h1 class='event-title' id='event-name'>
<header class='event-header'>
<h1 class='event-header__title' id='event-name'>
<?php echo $event->get_the_name(); ?>
</h1>
<p class="event-date-time"><?php $event->the_start_date_time(); ?></p>
<?php the_post_thumbnail( 'large' ); ?>
<p class="event-header__date-time"><?php $event->the_start_date_time(); ?></p>
<div class="ratio ratio-16x9 event-header__featured-image">
<?php the_post_thumbnail( 'choctaw-events-single', array( 'class' => 'object-fit-cover' ) ); ?>
</div>
</header>
<section class="event-body row">
<section class="event-body row mt-3">
<div id="event-description">
<?php $event->the_description(); ?>
</div>
Expand Down

0 comments on commit bb53358

Please sign in to comment.