Forum Replies Created
-
AuthorPosts
-
MarkMember
Andrea,
I was able to get the effect I wanted by doing some careful css selector specifications in style.css. There are other, more complex ways of tying a particular css file to a particular template, but if all you want is a few changes, the following approach is generally sufficient.
I thought I'd include an example of how I edited the style.css file in the child theme directory in case anyone else wants to do something similar:
.post-info { font-size: 11px; margin: 0 0 20px 0; padding: 0; text-transform: uppercase; } body.page-template-page_qa-php div.post-info { margin: 0 0 10px 0; }
The first entry (.post-info) came with the Executive child theme. The second entry is the one I added. It modifies the margin for any div having the post-info class attribute that exist on a page where the body tag has the page-template-page_qa-php class attribute.
That second class attribute is the key. It's unique to any file generated by my page_qa.php template file.
Here's an example where id selectors are used:
#content .post { margin: 0 0 40px 0; padding: 0; } body.page-template-page_qa-php #content .post { margin: 0; }
Again, the first entry is what came with the child theme. I added the second one. It modifies the margins on elements carrying the post class attribute that are descendants of an element carrying the #content id.
MarkMemberI was able to get things to work...and then I decided I didn't want to eliminate the information completely, so I used a filter to modify what was being shown (I ultimately decided I just didn't want to expose the comment functionality on that particular page).
Here's what I ended up with in my custom template file:
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
remove_action( 'genesis_post_content', 'genesis_do_post_content' );add_filter( 'genesis_post_info', 'mao_post_info_no_comment' );
add_filter( 'genesis_post_title_text', 'mao_post_title_text_qa' );function mao_post_info_no_comment( $post_info ) {
$post_info = 'posted by [post_author_posts_link] on [post_date] [post_edit]';
return $post_info;
}function mao_post_title_text_qa( $post_title ) {
if( in_category('question') ) {
return 'Q: ' . get_the_title();
}
elseif( in_category('answer') ) {
return 'A: ' . get_the_title();
}return get_the_title();
}Thanx for your help!
MarkMemberGood point. My MVC background is showing :).
MarkMemberThanks, Andrea. I considered that but didn't pursue it because it looked like more work than what I eventually did. Which basically was to include the static text in the custom template file as HTML markup.
It feels very wrong to include content in what amounts to a code file, but it worked. I may take a shot at using the widget area approach when the dust settles, because it would be nice to be able to use the dashboard page editing capability to change the introductory text. Rather than having to fire up a console to edit a code file.
-
AuthorPosts