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:
@@ -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
|
||||
|
||||
+1
-2
@@ -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' );
|
||||
|
||||
@@ -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