change .entry just on custom taxonomy possible?

Community Forums Forums Design Tips and Tricks change .entry just on custom taxonomy possible?

This topic is: resolved

Tagged: , , , ,

This topic contains 4 replies, has 2 voices, and was last updated by  bbcode 9 months, 3 weeks ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #72603

    bbcode
    Member
    Post count: 9

    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:
    null

    This is how it should looks like:
    null

    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 :)

    • This topic was modified 9 months, 3 weeks ago by  bbcode.
    • This topic was modified 9 months, 3 weeks ago by  bbcode.
    #72618

    braddalton
    Participant
    Post count: 9397

    Link to your site please.

    Grab the class from the source code and use that to change the .entry class for that specific taxonomy.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #72630

    bbcode
    Member
    Post count: 9

    Thanks 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. :/

    #72648

    braddalton
    Participant
    Post count: 9397

    Try .post-94 .entry

    Or you could add a custom body class http://my.studiopress.com/snippets/custom-body-class/


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #72662

    bbcode
    Member
    Post count: 9

    .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.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.