Community Forums › Forums › Archived Forums › General Discussion › Post Meta on Archive Pages
- This topic has 16 replies, 3 voices, and was last updated 9 years, 8 months ago by Summer.
-
AuthorPosts
-
August 24, 2014 at 3:28 pm #120818MealtogMember
So I managed to customize Filed Under and Tagged under posts. I see these also show up under the post exeprt on archive pages. Is there a way to disable this on the Archive pages>
August 24, 2014 at 5:03 pm #120825SummerMemberRemove the post_meta hook from all your archives, using either a conditional in functions.php, or create an archive.php with just that call to remove the post_meta in it.
edit: LOL -- I just found this: http://2013.minneapolis.wordcamp.org/2013/04/27/wordpress-theme-template-poster/
Definitely more colorful than the Codex Template Hierarchy 🙂
WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
Slice of SciFi | Writers, After DarkAugust 25, 2014 at 2:59 pm #120994MealtogMemberI have been meaning to test out different looking archive pages. Wished Genesis would come with a few standard ones that are generic enough for us to edit. I remembers spending loads of time to find a template that I can drop in to a Gen child theme a while back and the result was a big fat zero. 🙂
August 25, 2014 at 4:18 pm #121011SummerMemberElaborate on "test out different looking archive pages"?
You can create the layout you want in the archive template, same as you would a 404 page or a landing page, and you just copy a blank template, give it the name you need, and add the elements you want, any time.
Or did I misunderstand your statement? You wanted cookie-cutter templates for every WordPress template possibility to be able to drop into a child theme when you need them?
Hmm. I've made enough different ones over the years for Genesis themes and my own customizations... wonder if I should put up tutorials or something... nah, Brad probably already has 200 of them (or will by tonight) 😉
WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
Slice of SciFi | Writers, After DarkAugust 25, 2014 at 10:28 pm #121051MealtogMemberHmm, do you have a quick tutorial that I can try this out. I have never had to do this yet but having an easy way to display certain categories would be a good thing. Say, I want to show 3 columns of just thumbnails and title for the entire category with max of say 60 then user can click to Page 2. Does that make sense?
Some Categories may not even have 60 so displaying them in a nice grid would be nice. I saw a plugin that sort of does this (Gen Grid maybe) but it was too
uglybuggy to roll out.August 25, 2014 at 11:40 pm #121059SummerMemberI can show you some live sites with templates similar to that, and you can tell me if that's what you're looking for, or close to?
Look at these:
http://www.dragonpage.com/category/library/
http://www.sliceofscifi.tv/videos/Both are using customized templates, category-ID.php on both sites, but dragonpage is Genesis and Slice TV is not.
WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
Slice of SciFi | Writers, After DarkAugust 26, 2014 at 12:49 am #121062MealtogMemberThose are exactly it. I can style each element but first I need to know how to create the template.php file and how to implement it. I am thinking I will make these specific to a category, thus, I think the naming has to match a category right? Any insight on how I can do this would be fantastic!
August 26, 2014 at 1:15 am #121064SummerMemberYes, you need to name the template either category-slug.php or category-ID.php, where you use either the slug for the category, or the ID number... ie, category-shows.php or category-17.php
If you need Genesis features, here's what I did with dragonpage.com:
force a full_width layout
remove_action calls for post_content, post_image, post_meta and post_excerpt_readmore (you probably don't have that last one, it was something custom I wrote).
I added a filter to add another body-class to the thumbnail image, so I could add a set of CSS rules for the styling you see.
add_filter('post_class', 'library_post_class'); function library_post_class( $classes ) { global $loop_counter; $paged = get_query_var('paged') ? get_query_var('paged') : 1; $classes[] = 'library-posts'; return $classes; }
I also customized the post_info using the filter from the StudioPress Code Snippets, because this was one of the sites where the Simple Edits plugin stopped working.
and the loop for the image (for what you can use) is this:
// Add featured image above title on teasers add_action('genesis_before_post_title', 'library_teaser_image'); function library_teaser_image() { global $loop_counter; $paged = get_query_var('paged') ? get_query_var('paged') : 1; printf( '<p><a href="%s">%s</a></p>', get_permalink(), genesis_get_image ( array( 'format' => 'html', 'size'=> 'library-thumb' ) ) ); } }
Most of the inspiration for this code came from the portfolio page code that I saw being used in a few child themes both here and at Appfinite.
WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
Slice of SciFi | Writers, After DarkAugust 26, 2014 at 1:18 am #121065henrikMemberDid you try to click your customized setting? It may also work.
August 26, 2014 at 3:51 am #121083MealtogMemberok, I sort of understand. Fist of all, what goes into the category-ID.php page? I tried grabbing theme-defaults.php as is and it broek that category.
August 26, 2014 at 7:44 am #121102SummerMemberEverything I listed above. With Genesis you don't have to put in a ton of extra stuff, because it does the heavy lifting for you.
When you look at templates like page_landing.php and page_portfolio.php, does the code there make sense to you? There's typically not a lot there... I have some templates that have 5 lines of code in it, including the closing
genesis();
call.What child themes do you have access to that you can look at the code for? And I'm a little concerned where you'd got the idea that theme-defaults.php would be something you'd need in a template 🙂
Look at category.php for TwentyThirteen. Ignore those calls to
get_template_part();
(please!).Now imagine copying that file to a category-44.php, and changing a few things in that new file to suit your tastes.
That's how simple it is, and with Genesis it would be even simpler.
For example, a template that would modify the post_info as you were asking about in a previous topic would look something like this:
<?php /* Template Name: News Category Template */ // Force full width layout add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); // Customize the post info add_filter('genesis_post_info', 'ct_post_info_filter'); function ct_post_info_filter($post_info) { $post_info = '[post_date] [post_comments]'; return $post_info; } genesis();
That code inside a template called category-44.php, where your "News" category has an ID of 44, will change your post_info to only display the date and the comments... handy for if you have a lot of people posting in a generic news category but don't need their username showing up in category listings, but you also don't want to fight with Simple Edits overriding customizations in different displays (so you'd have Simple Edits disabled or not installed).
And that's literally all there is to it. One caveat, the above code was for a site that's still running an xhtml theme... just change the filter to use the HTML5 call if you need it for an HTML5 theme. These days, you could just select Default Layout from the category settings, and call it a day (but this template was written before that option existed in Genesis by default).
WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
Slice of SciFi | Writers, After DarkAugust 26, 2014 at 12:30 pm #121166MealtogMemberhey thanks for the great tutorial in here. I will just have to figure out which elements I want to call and add these to the .php file. I do see each category has a layout that you can choose from. For my case, I would still use the default layout, but i just want the body portion to look different. Will have to keep testing and finding the right codes.
So Outreach does have a a page_landing.php file. I used that in a category-id.php file and it works. Is there a theme that you may know of that has say, the default layout but just a Featured Image and title in the body? Would love to find one that I just use.
Also, I used cpanel to create the category.php file. Does Genesis allow us to create this file from WP itself?
Again, thanks so much for all your help thus far! Not just for the above but for all other feedback you contribute to my other posts and within this forum.
Come to think of it, I can just view each HTML5 theme at SP and find the ones with portfolios and perhaps I can just grab those .php files? Would that work?
August 26, 2014 at 1:53 pm #121187SummerMemberIf you have purchased those themes, then any one you can download that has a portfolio template it in should suffice.
WordPress does not allow creating new files from the internal editor (and you really should avoid using that if you can, or at least don't edit functions.php with it). Genesis will use whatever templates you add to the child theme, and it really doesn't care if you have them or not, it will fill in the blanks -- that's the beauty of the framework.
If you look at the code I pasted in the first examples, you'll see that those do exactly what you asked about... a featured image and a title. If you add that to the rest of the template example, you'll have 90% of the template you see that creates the Library listings at Dragon Page. All you'd need to do is modify the CSS... or use a widgetized home page, and select the Featured Posts widget to only display the image and post title...
I didn't realize you were asking for the entire template, I thought you were coding your own and had just become stuck 🙂
WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
Slice of SciFi | Writers, After DarkAugust 26, 2014 at 3:21 pm #121204MealtogMemberHey, the 2nd example works. When I tried adding the 2nd part of the first example, it breaks the category page. I think there is an extra } at the end.
After removing this, the category page did not change. I must be missing something?
<?php /* Template Name: News Category Template */ // Force default width layout add_filter( 'genesis_theme_settings_defaults', 'outreach_theme_defaults' ); add_filter('post_class', 'library_post_class'); function library_post_class( $classes ) { global $loop_counter; $paged = get_query_var('paged') ? get_query_var('paged') : 1; $classes[] = 'library-posts'; return $classes; } // Add featured image above title on teasers add_action('genesis_before_post_title', 'library_teaser_image'); function library_teaser_image() { global $loop_counter; $paged = get_query_var('paged') ? get_query_var('paged') : 1; printf( '<p><a href="%s">%s</a></p>', get_permalink(), genesis_get_image ( array( 'format' => 'html', 'size'=> 'library-thumb' ) ) ); } genesis();
August 26, 2014 at 4:30 pm #121219SummerMemberThe filter for the post class just adds a class to each post, so I could more easily style the entire thing. You wouldn't see a visible change on the page, but if you looked at the source, you'd see "library-posts" as an additional class.
Is your theme xhtml or html5? The action call in the second snippet won't work for an html5 theme... you'd have to replace it with genesis_entry_header, and add a priority level number... I think I've seen 12 used in other examples. You'd also have to change the image size to one you have defined in your theme (I'm pretty sure library-thumb isn't something many folks would use).
If you add the snippet for changing just the post info, you should see that change on the page.
WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
Slice of SciFi | Writers, After DarkAugust 26, 2014 at 4:42 pm #121220MealtogMemberI think the Simple Edits plugin is preventing the post info to be changed. And the theme is indeed HTML5 so I may have to keep testing. Thanks so much for getting me started. Maybe SP should come up with some common layouts for us non developer types 🙂
August 26, 2014 at 6:00 pm #121228SummerMemberJust disable Simple Edits and see what changes; it's no big deal to turn it back on again... and as I had said in another, Simple Edits works fine on two sites with custom templatesand Co-Authors, but dragonpage is one where it doesn't... I had to get rid of it there.
It's weird, but it's code, so it is what it is 🙂
WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
Slice of SciFi | Writers, After Dark -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.