Community Forums › Forums › Archived Forums › Design Tips and Tricks › change .entry just on custom taxonomy possible?
- This topic has 4 replies, 2 voices, and was last updated 10 years, 10 months ago by bbcode.
-
AuthorPosts
-
November 12, 2013 at 8:11 pm #72603bbcodeMember
hi,
i added a custom post type and a custom taxonomy for this post type. all works fine.
mysite.com/products/ looks good but now i want to change the .entry css class just for this product taxonomy. how can i do it? my english is not really good, i try to show you 2 screenshots you can understand a bit better. 🙂
This is how it looks like now:
This is how it should looks like:
The Problem is i changed the ".entry" class on my css file, this also change the .entrys on the whole page. but i just want to change it on this taxonomy. Is this just possible with remove the custom genesis loop and build a new one with another class?
Thanks and greetings from Germany 🙂
November 12, 2013 at 9:34 pm #72618Brad DaltonParticipantLink to your site please.
Grab the class from the source code and use that to change the .entry class for that specific taxonomy.
November 12, 2013 at 10:27 pm #72630bbcodeMemberThanks for your fast response,
the page is actually not online, i just build it on localhost right now.
The source code is:
<article class="post-94 letsplay type-letsplay status-publish entry" itemscope="itemscope" itemtype="http://schema.org/CreativeWork"><header class="entry-header"></header><div class="entry-content" itemprop="text"><a href="http://localhost/letsplay/splinter-cell-blacklist/" title="Splinter Cell: Blacklist"><img width="171" height="242" src="http://localhost/wp-content/uploads/2013/11/splinter_cell_blacklist_cover-171x242.jpg" class="alignleft post-image entry-image" alt="Splinter Cell Blacklist Cover" itemprop="image"></a></div></article>
My custom post-type is "letsplay" and the taxonomy is "letsplays" - looks like im not good enough to find out how to combine these informations to change the ".entry" just on the taxonomy. :/
November 13, 2013 at 12:07 am #72648Brad DaltonParticipantTry .post-94 .entry
Or you could add a custom body class http://my.studiopress.com/snippets/custom-body-class/
November 13, 2013 at 2:48 am #72662bbcodeMember.post-94 .entry can't work because its just one entry, but i want to change the width of all entrys, just on taxonomy page. And the html code is the same on the single custom page site, this would break the entry on the singlepage too.
I think i can't call the class .entry just for the taxonomy page. Looks like i need to change the loop for this taxonomy.
~ Update ~
I found an easy solution. it works like a charm, but im not sure that i find the best way to do it. but.. lets show you my code to do this. maybee someone will have the same problem in the future.
First you need to remove the genesis loop and add a normal WordPress Loop on your taxonomy-name.php file:
<?php remove_action('genesis_loop','genesis_do_loop'); add_action('genesis_loop','letsplays_loop'); function letsplays_loop() { while(have_posts()) : the_post(); the_post_thumbnail ( 'cover-small' ); endwhile; } genesis(); ?>
Now you get your thumbnails. The size of the thumbnails "cover-small" comes from the function "add_image_size" in functions.php the standard way.
to permalink the thumbnails to the post you want to you just need to put this code in your function.php:
add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 3 ); function my_post_image_html( $html, $post_id, $post_image_id ) { $html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_the_title( $post_id ) ) . '">' . $html . '</a>'; return $html; }
Now all your thumbnails on your page are linked to the posts there come from.
To style your custom taxonomy thumbnails just open your css and add
.attachment-cover-small { yourstyles: #fff; }
Not styled yet, but soon.
Hope this can help someone, and thanks for your help braddalton.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.