mirror of
https://github.com/10h30/display-featured-image-genesis.git
synced 2026-06-05 15:08:20 +09:00
add documentation
This commit is contained in:
@@ -20,9 +20,9 @@ _Note: although this plugin requires the [Genesis Framework by StudioPress](http
|
|||||||
|
|
||||||
__Display Featured Image for Genesis__ now allows you to select a default, or fallback, Featured Image, which will be used if a post/page does not have a Featured Image set, or if the post/page's Featured Image is too small (smaller than your medium image setting), and on archive pages. You may set the Default Featured Image under Appearance > Display Featured Image Settings.
|
__Display Featured Image for Genesis__ now allows you to select a default, or fallback, Featured Image, which will be used if a post/page does not have a Featured Image set, or if the post/page's Featured Image is too small (smaller than your medium image setting), and on archive pages. You may set the Default Featured Image under Appearance > Display Featured Image Settings.
|
||||||
|
|
||||||
As of version x.y.z, you can now set a Featured Image for each taxonomy (categories, tags, and any taxonomy for custom post types). This image will be used on taxonomy archives, and as a fallback image for posts within that taxonomy if no featured image exists (or if the featured image is too small).
|
As of version x.y.z, you can now set a Featured Image for each taxonomy (categories, tags, and any taxonomy for custom post types). This image will be used on taxonomy archives, and as a fallback image for posts within that taxonomy if no featured image exists (or if the featured image is too small). If a post is assigned to multiple terms, the most used term will be the one used.
|
||||||
|
|
||||||
#### New: Add Your Featured Image to Your RSS Feed
|
#### Add Your Featured Image to Your RSS Feed
|
||||||
|
|
||||||
Now you can add the Featured Image from each post to your RSS feed. This is an optional setting and applied intelligently:
|
Now you can add the Featured Image from each post to your RSS feed. This is an optional setting and applied intelligently:
|
||||||
|
|
||||||
@@ -155,6 +155,7 @@ _Note:_ unless you check the option to __Move Excerpts/Archive Descriptions__, a
|
|||||||
|
|
||||||
### x.y.z
|
### x.y.z
|
||||||
* added featured images to taxonomies!
|
* added featured images to taxonomies!
|
||||||
|
* added featured images to admin archive pages!
|
||||||
* added new setting to not move post titles to overlay Featured Image
|
* added new setting to not move post titles to overlay Featured Image
|
||||||
|
|
||||||
### 1.5.0 - 2014-12-13
|
### 1.5.0 - 2014-12-13
|
||||||
|
|||||||
@@ -8,8 +8,13 @@
|
|||||||
*/
|
*/
|
||||||
class Display_Featured_Image_Genesis_Taxonomies {
|
class Display_Featured_Image_Genesis_Taxonomies {
|
||||||
|
|
||||||
function set_taxonomy_meta() {
|
/**
|
||||||
$args = array( 'public' => true );
|
* set up all actions for adding featured images to taxonomies
|
||||||
|
*/
|
||||||
|
public function set_taxonomy_meta() {
|
||||||
|
$args = array(
|
||||||
|
'public' => true
|
||||||
|
);
|
||||||
$output = 'names';
|
$output = 'names';
|
||||||
$taxonomies = get_taxonomies( $args, $output );
|
$taxonomies = get_taxonomies( $args, $output );
|
||||||
foreach ( $taxonomies as $taxonomy ) {
|
foreach ( $taxonomies as $taxonomy ) {
|
||||||
@@ -20,25 +25,11 @@ class Display_Featured_Image_Genesis_Taxonomies {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_columns_post_types() {
|
/**
|
||||||
$args = array(
|
* add featured image uploader to new taxonomy add
|
||||||
'public' => true,
|
*/
|
||||||
'_builtin' => false,
|
public function add_taxonomy_meta_fields() {
|
||||||
);
|
|
||||||
$output = 'names';
|
|
||||||
$post_types = get_post_types( $args, $output );
|
|
||||||
$post_types['post'] = 'post';
|
|
||||||
$post_types['page'] = 'page';
|
|
||||||
foreach ( $post_types as $post_type ) {
|
|
||||||
add_filter( "manage_{$post_type}_posts_columns", array( $this, 'add_post_columns' ) );
|
|
||||||
add_action( "manage_{$post_type}_posts_custom_column", array( $this, 'custom_post_columns' ), 10, 2 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function add_taxonomy_meta_fields() {
|
|
||||||
|
|
||||||
//* this will add the custom meta field to the add new term page
|
|
||||||
echo '<div class="form-field">';
|
echo '<div class="form-field">';
|
||||||
echo '<label for="term_meta[dfig_image]">' . __( 'Featured Image', 'display-featured-image-genesis' ) . '</label>';
|
echo '<label for="term_meta[dfig_image]">' . __( 'Featured Image', 'display-featured-image-genesis' ) . '</label>';
|
||||||
echo '<input type="url" id="default_image_url" name="term_meta[dfig_image]" style="width:200px;" />';
|
echo '<input type="url" id="default_image_url" name="term_meta[dfig_image]" style="width:200px;" />';
|
||||||
@@ -48,15 +39,16 @@ class Display_Featured_Image_Genesis_Taxonomies {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//* Edit term page
|
/**
|
||||||
function edit_taxonomy_meta_fields( $term ) {
|
* edit term page
|
||||||
|
* @param term $term featured image input/display for individual term page
|
||||||
|
* @return preview/uploader upload/preview featured image for term
|
||||||
|
*/
|
||||||
|
public function edit_taxonomy_meta_fields( $term ) {
|
||||||
|
|
||||||
//* put the term ID into a variable
|
$t_id = $term->term_id;
|
||||||
$t_id = $term->term_id;
|
|
||||||
|
|
||||||
//* retrieve the existing value(s) for this meta field. This returns an array
|
|
||||||
$term_meta = get_option( "taxonomy_$t_id" );
|
$term_meta = get_option( "taxonomy_$t_id" );
|
||||||
//* this will add the custom meta field to the add new term page
|
|
||||||
echo '<tr class="form-field">';
|
echo '<tr class="form-field">';
|
||||||
echo '<th scope="row" valign="top"><label for="term_meta[dfig_image]">' . __( 'Featured Image', 'display-featured-image-genesis' ) . '</label></th>';
|
echo '<th scope="row" valign="top"><label for="term_meta[dfig_image]">' . __( 'Featured Image', 'display-featured-image-genesis' ) . '</label></th>';
|
||||||
echo '<td>';
|
echo '<td>';
|
||||||
@@ -77,8 +69,15 @@ class Display_Featured_Image_Genesis_Taxonomies {
|
|||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
//* Save extra taxonomy fields callback function.
|
/**
|
||||||
function save_taxonomy_custom_meta( $term_id ) {
|
* Save extra taxonomy fields callback function.
|
||||||
|
* @param term id $term_id the id of the term
|
||||||
|
* @return updated option updated option for term featured image
|
||||||
|
*
|
||||||
|
* @since x.y.z
|
||||||
|
*/
|
||||||
|
public function save_taxonomy_custom_meta( $term_id ) {
|
||||||
|
|
||||||
if ( isset( $_POST['term_meta'] ) ) {
|
if ( isset( $_POST['term_meta'] ) ) {
|
||||||
$t_id = $term_id;
|
$t_id = $term_id;
|
||||||
$term_meta = get_option( "taxonomy_$t_id" );
|
$term_meta = get_option( "taxonomy_$t_id" );
|
||||||
@@ -94,6 +93,7 @@ class Display_Featured_Image_Genesis_Taxonomies {
|
|||||||
//* Save the option array.
|
//* Save the option array.
|
||||||
update_option( "taxonomy_$t_id", $term_meta );
|
update_option( "taxonomy_$t_id", $term_meta );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user