From e3db022b760254df95cc6e306ea53b3da46b6ed1 Mon Sep 17 00:00:00 2001 From: MickeyKay Date: Thu, 26 Jun 2014 13:47:11 -0700 Subject: [PATCH] IMPORTANT: Fix bug with tresle_post_info_meta() function causing posts to spontaneously change post_type when running looping through a query. Please update to this patch if you have a previous version. --- README.md | 2 +- functions.php | 3 +-- lib/admin/admin-functions.php | 12 ++++++++++++ lib/functions/theme-functions.php | 24 ------------------------ 4 files changed, 14 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 4349b3c..d61b9af 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Trestle takes a lot of the grunt work out of building sites using the Genesis Fr Here are some of Trestle's many features, check out the [Trestle Demo](http://demo.mightyminnow.com/theme/trestle/) for a full list. * Responsive navigation menu * Mobile first CSS -* ~~Custom control over post info and meta~~ (temporarily absent while we fix a bug) +* Custom control over post info and meta * Multiple page layouts * Auto-generating primary navigation * Ability to auto-install your favorite plugins diff --git a/functions.php b/functions.php index 0d0d8d4..5145f37 100644 --- a/functions.php +++ b/functions.php @@ -100,8 +100,7 @@ function trestle_theme_setup() { add_filter( 'wp_revisions_to_keep', 'trestle_update_revisions_number', 10, 2 ); // Manually control where Post Info & Meta display - /* @TODO: temporarily commented this line out because it's causing posts to randomly switch post type! */ - //add_action( 'the_post', 'trestle_post_info_meta', 0 ); + add_action( 'the_post', 'trestle_post_info_meta', 5 ); // Remove default featured image fallback of 'first-attached' add_filter( 'genesis_get_image_default_args', 'trestle_featured_image_fallback' ); diff --git a/lib/admin/admin-functions.php b/lib/admin/admin-functions.php index 2337d31..b3f31e0 100644 --- a/lib/admin/admin-functions.php +++ b/lib/admin/admin-functions.php @@ -228,6 +228,12 @@ function trestle_settings_box() { labels->name; $slug = $post_type_object->name; @@ -248,6 +254,12 @@ function trestle_settings_box() { labels->name; $slug = $post_type_object->name; diff --git a/lib/functions/theme-functions.php b/lib/functions/theme-functions.php index c0ee735..1139f8e 100644 --- a/lib/functions/theme-functions.php +++ b/lib/functions/theme-functions.php @@ -343,15 +343,7 @@ function trestle_post_info_meta() { global $post; // Get post type - $orig_post_type = ''; - $post_type = get_post_type( $post->ID ); - - // Override "page" post type to allow for Post Info & Meta (reset back to page below) - if ( 'page' == $post_type ) { - $orig_post_type = 'page'; - set_post_type( $post->ID, 'post' ); - } // Remove all Post Info & Meta remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); @@ -384,10 +376,6 @@ function trestle_post_info_meta() { if ( genesis_get_option( $archive_meta_option ) ) add_action( 'genesis_entry_footer', 'genesis_post_meta' ); } - - // Reset post type back to page if need be - if ( ! empty( $orig_post_type ) && 'page' == $orig_post_type ) - add_action( 'genesis_entry_footer', 'trestle_set_page_post_type' ); } } @@ -413,18 +401,6 @@ function trestle_featured_image_fallback( $args ) { * General Actions & Filters ===========================================*/ -/** - * Resets post type back to page once post info / meta functionality is done. - * - * @since 1.0.0 - * - * @global object $post The current $post object. - */ -function trestle_set_page_post_type() { - global $post; - set_post_type( $post->ID, 'page' ); -} - /** * Displays custom Trestle "read more" text in place of WordPress default. *