Questions about functions.php
-
Hello everyone! First of all, sorry me if my English isn’t very clear but it’s not my native language, so I’ll try to do my best with these questions.
I’ve a site running the last version of WordPress and I need to introduce two modifications regarding posts and style sheet. To begin, I want to give a different style to the first post on index.php page but I don’t know how to do that. ?It’s necessary to modify that on content.php page or can I define the style for that post on index loop?
Also I’ve three categories on the site (let’s suppose they’re CAT A, CAT B and CAT C). All the posts under a certain category must have a different style on the title and button read more. CAT A style must be “btn-more-A”, CAT B must be “btn-more-B” and CAT C (or any other future category) must be “btn-more-A”. I’m using this code on functions.php to add the read more link…
function new_excerpt_more( $more ) { if ( in_category('cat_a') || is_category('cat_a') ) return '...</p> <a href="'. get_permalink( get_the_ID() ) . '" class="btn-more-A">READ MORE...</a>'; elseif ( in_category('cat_b') || is_category('cat_b') ) return '...</p> <a href="'. get_permalink( get_the_ID() ) . '" class="btn-more-B">READ MORE...</a>'; else { return '...</p> <a href="'. get_permalink( get_the_ID() ) . '" class="btn-more-A">READ MORE...</a>'; } } add_filter( 'excerpt_more', 'new_excerpt_more' );
Thanks in advance, the forum is really helpfull! =)
- The topic ‘Questions about functions.php’ is closed to new replies.