Forum Replies Created
-
AuthorPosts
-
April 15, 2017 at 9:02 am in reply to: Use 2 Different Featured Image Sizes In Content Archives 1 for Blog & 1 for CPT? #204825SeoGreenPeaMember
Thank you Brad, but I've come up with my own solution. I'm sure your solution is probably better, but this is what I was able to use that allowed me to accomplish the end result I was after.
// This removes the featured image from books archive entries add_action('genesis_before_loop','custom_remove_book_featured_image'); function custom_remove_book_featured_image() { if ( is_post_type_archive( 'books' ) || is_archive() && is_tax( 'book-type' ) ) { remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 ); } } // This adds the featured image size ‘book’ to my books archive entries add_action( 'genesis_entry_content', 'custom_add_book_featured_image', 1 ); function custom_add_book_featured_image() { global $post; if ( is_post_type_archive( 'books' ) || is_archive() && is_tax( 'book-type' ) ) { if ( $image = genesis_get_image( 'format=url&size=book' ) ) { printf( '<div class="featuredbookimage"><img src="%s" alt="%s" class="aligncenter" itemprop="image" /></div>', $image, the_title_attribute( 'echo=0' ) ); } else { printf( '<div class="featuredbookimage"><img src="%s" alt="%s" class="aligncenter" /></div>', get_bloginfo( 'stylesheet_directory' ) . '/images/noimage200200.png', the_title_attribute( 'echo=0' ) ); } } }
March 20, 2017 at 9:15 am in reply to: Show Specific Taxonomy Types in Genesis Entry Footer / Post Meta / Post Terms #203471SeoGreenPeaMemberI appreciate you providing your input, referenced options and examples.
I'll still need to probably figure out how to create my own custom genesis post terms shortcode using the get_terms method so I can select a specific taxonomy and exclude the others that are attached to my custom post type. Because I have tons of taxonomies and child taxonomies, my code above might not be efficient, even if I did figure out how to attach a permalink to a custom field.
Thank you.
I'm still looking for a solution that will work for my issue.
March 20, 2017 at 7:57 am in reply to: Show Specific Taxonomy Types in Genesis Entry Footer / Post Meta / Post Terms #203452SeoGreenPeaMemberThank you, I'll have to look into "filter it using genesis_post_terms_shortcode" which I'm not familiar with.
I thought I'd offer up another solution I'm considering trying out.
Each of my taxonomies have a custom field value that I'm using to output throughout the site elsewhere and for markup purposes.
I thought I might skip the entire...
if ('book' == get_post_type() || is_tax( 'book-type' ) ) {
$post_meta = '[post_terms taxonomy="book-type" before="Type Of Book: "]';
return $post_meta;
}and just use a function similar to...
add_action('genesis_entry_footer', 'custom_post_meta_filter'); function custom_post_meta_filter() { if ('book' == get_post_type() || is_tax( 'book-type' ) ) && genesis_get_custom_field('book_tax_type_name_scary') ) && genesis_get_custom_field('book_tax_type_name_reading_level_one') ) echo '<p class="entry-meta">Type Of Book: '. genesis_get_custom_field('book_tax_type_name_scary') .', '. genesis_get_custom_field('book_tax_type_name_reading_level_one') .'</p>'; }
But then because I'm using approximately 100 different taxonomy types that all have approximately 10-15 child taxonomy types, I'd end up writing a ton of functions. Assuming my above example would even work. The additional problem with the above code is that I wouldn't have the permalink attached to the custom field, which is also another obstacle.
I'm sure I can learn how to include the permalink, but I'll have to see if the code above even accomplishes what I'm after.
Using the genesis_post_terms_shortcode sure sounds easier and more efficient though.
Thanks for your input!
March 20, 2017 at 7:21 am in reply to: Show Specific Taxonomy Types in Genesis Entry Footer / Post Meta / Post Terms #203446SeoGreenPeaMemberI guess I'm not quite following you, but I appreciate your time in suggesting.
Still looking for a solution.
Thanks.
-
AuthorPosts