mirror of
https://github.com/10h30/trestle.git
synced 2026-06-05 15:09:35 +09:00
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.
This commit is contained in:
@@ -228,6 +228,12 @@ function trestle_settings_box() {
|
||||
<?php
|
||||
$post_types = get_post_types();
|
||||
foreach ( $post_types as $post_type ) {
|
||||
// Don't show this option for pages, since genesis_post_info/meta won't work for pages
|
||||
if ( 'page' == $post_type ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Otherwise generate post info settings
|
||||
$post_type_object = get_post_type_object( $post_type );
|
||||
$name = $post_type_object->labels->name;
|
||||
$slug = $post_type_object->name;
|
||||
@@ -248,6 +254,12 @@ function trestle_settings_box() {
|
||||
<?php
|
||||
$post_types = get_post_types();
|
||||
foreach ( $post_types as $post_type ) {
|
||||
// Don't show this option for pages, since genesis_post_info/meta won't work for pages
|
||||
if ( 'page' == $post_type ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Otherwise generate post meta settings
|
||||
$post_type_object = get_post_type_object( $post_type );
|
||||
$name = $post_type_object->labels->name;
|
||||
$slug = $post_type_object->name;
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user