Skip to content

Commit

Permalink
Merge branch 'release/1.4.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
JiveDig committed Dec 5, 2024
2 parents 3bbdced + e43ec1a commit a9fc9d5
Show file tree
Hide file tree
Showing 63 changed files with 622 additions and 405 deletions.
6 changes: 5 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.4.2 (12/5/24)
* Changed: Updated the updater.
* Changed: Change processed content processing order to match Mai Engine and WP.

## 1.4.1 (1/3/24)
* Fixed: Only load choices in the archive page editor. Fixes error when it trying to load fields on other screens.

Expand All @@ -10,7 +14,7 @@

## 1.3.1 (11/27/23)
* Changed: Moves before content before content-sidebar-wrap element.
* Changed: Updated updater.
* Changed: Updated the updater.

## 1.3.0 (8/2/23)
* Added: [Developers] Moved class methods to helper functions for more flexibility.
Expand Down
27 changes: 16 additions & 11 deletions classes/class-mai-archive-pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -578,10 +578,12 @@ function do_content( $before ) {
return;
}

if ( 'publish' === $status || ( 'private' === $status && current_user_can( 'edit_posts' ) ) ) {
$content = $this->get_processed_content( $post->post_content );
if ( 'publish' !== $status || ( 'private' === $status && ! current_user_can( 'edit_posts' ) ) ) {
return;
}

$content = $this->get_processed_content( $post->post_content );

if ( ! $content ) {
return;
}
Expand Down Expand Up @@ -689,6 +691,7 @@ function permalink( $url, $post ) {
* Gets processed content, ready for display.
*
* @since 0.1.0
* @since TBD Change order of processing to match Mai Engine, which matches WP.
*
* @param string $content The raw content.
*
Expand All @@ -706,15 +709,17 @@ function get_processed_content( $content ) {
*/
global $wp_embed;

$content = $wp_embed->autoembed( $content ); // WP runs priority 8.
$content = $wp_embed->run_shortcode( $content ); // WP runs priority 8.
$content = do_blocks( $content ); // WP runs priority 9.
$content = wptexturize( $content ); // WP runs priority 10.
$content = wpautop( $content ); // WP runs priority 10.
$content = shortcode_unautop( $content ); // WP runs priority 10.
$content = function_exists( 'wp_filter_content_tags' ) ? wp_filter_content_tags( $content ) : wp_make_content_images_responsive( $content ); // WP runs priority 10. WP 5.5 with fallback.
$content = do_shortcode( $content ); // WP runs priority 11.
$content = convert_smilies( $content ); // WP runs priority 20.
$blocks = has_blocks( $content );
$content = $wp_embed->autoembed( $content ); // WP runs priority 8.
$content = $wp_embed->run_shortcode( $content ); // WP runs priority 8.
$content = $blocks ? do_blocks( $content ) : $content; // WP runs priority 9.
$content = wptexturize( $content ); // WP runs priority 10.
$content = ! $blocks ? wpautop( $content ) : $content; // WP runs priority 10.
$content = shortcode_unautop( $content ); // WP runs priority 10.
$content = do_shortcode( $content ); // WP runs priority 11.
$content = wp_filter_content_tags( $content ); // WP runs priority 12.
$content = convert_smilies( $content ); // WP runs priority 20.
$content = str_replace( ']]>', ']]>', $content );

return $content;
}
Expand Down
16 changes: 8 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 27 additions & 3 deletions mai-archive-pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin Name: Mai Archive Pages
* Plugin URI: https://bizbudding.com/mai-design-pack/
* Description: Build robust and SEO-friendly archive pages with blocks.
* Version: 1.4.1
* Version: 1.4.2
*
* Author: BizBudding
* Author URI: https://bizbudding.com
Expand Down Expand Up @@ -92,7 +92,7 @@ public function __wakeup() {
private function setup_constants() {
// Plugin version.
if ( ! defined( 'MAI_ARCHIVE_PAGES_PLUGIN_VERSION' ) ) {
define( 'MAI_ARCHIVE_PAGES_PLUGIN_VERSION', '1.4.1' );
define( 'MAI_ARCHIVE_PAGES_PLUGIN_VERSION', '1.4.2' );
}

// Plugin Folder Path.
Expand Down Expand Up @@ -153,6 +153,7 @@ public function hooks() {
add_action( 'init', [ $this, 'register_content_types' ] );
add_action( 'acf/init', [ $this, 'register_field_group' ] );
add_filter( 'acf/load_field/key=maiap_location', [ $this, 'load_location_choices' ] );
add_action( 'admin_menu', [ $this, 'admin_menu_page' ] );
add_action( 'init', [ $this, 'init' ] );

register_activation_hook( __FILE__, array( $this, 'activate' ) );
Expand Down Expand Up @@ -229,7 +230,11 @@ public function register_content_types() {
'show_tagcloud' => false,
'show_ui' => true,
'rewrite' => false,
'supports' => array( 'title', 'editor' ),
'supports' => [ 'title', 'editor' ],
'map_meta_cap' => true, // Allow editing.
'capabilities' => [
'create_posts' => 'do_not_allow', // Disable new posts.
],
) );
}

Expand Down Expand Up @@ -310,6 +315,25 @@ function load_location_choices( $field ) {
return $field;
}

/**
* Registers plugin admin menu pages.
*
* @since TBD
*
* @return void
*/
function admin_menu_page() {
add_submenu_page(
'mai-theme',
esc_html__( 'Archive Pages', 'mai-archive-pages' ),
esc_html__( 'Archive Pages', 'mai-archive-pages' ),
'edit_posts',
'edit.php?post_type=mai_archive_page',
'',
null
);
}

/**
* Plugin init.
*
Expand Down
Loading

0 comments on commit a9fc9d5

Please sign in to comment.