Community Forums › Forums › Archived Forums › General Discussion › How to make *simple* custom archive page in a Genesis child theme
Tagged: archive page, child theme, genesis, page template
- This topic has 5 replies, 2 voices, and was last updated 9 years, 1 month ago by Brad Dalton.
May 5, 2014 at 2:41 pm #103749
I am working on my first Genesis child theme and could really use some help. I'd like to create an archive page which is exactly like the standard one, but with one small change: I need each post's Heading to be UN-linked. That's all.
I know how to create a .php file with the correct page-template header, and how to create a new Page choosing it as its template.
What I'm looking for, I think, is the basic PHP code for a Genesis archive page - if there is such a thing? I've looked at the Genesis theme files, and I have to admit I'm confused. I was hoping I could just copy over the regular archive page code and find the line that calls each post's Heading and remove the link, but frankly, I don't understand the Genesis theme files.
I've read a 4-5 Genesis tutorials on this, but they all proceed to write code to create unusual, specific types of archive pages, so didn't solve my problem.
If someone could point me in the right direction, I'd really appreciate it!
Thanks in advance,
PattyMay 5, 2014 at 3:53 pm #103762
You would need to filter the title conditionally and remove the code which generates the link which looks like this:
<a href="' . get_permalink() .
You name it according to the Template Hierarchy https://codex.wordpress.org/Template_Hierarchy
Copying over a file from a parent theme and editing the code is poor practice and hacking which occurs far to often.
Learning how to use filters which are already built into WordPress and Genesis is best practice.
May 5, 2014 at 4:30 pm #103766
Hm.. my understanding (from StudioPress support and Genesis tutorials) is that with Genesis I'm supposed to create *page templates*, the type that are chosen from the drop-down list on the Edit Page screen, not theme files named according to the template hierarchy.
Also, for the record, WordPress.org's official Documentation specifically recommends copying parent theme files over into a child theme.
Thank you very much for the directions on filtering the post headings. I'll come back to that once I figure out how to code the page.
So I'm still looking for information on how to code a Genesis child theme page template for an archive page, if anyone can give me a hand.
PattyMay 5, 2014 at 5:36 pm #103774
Link to your site please.
The official documentation relates to parent themes like the default themes which are coded differently to Genesis.
When it comes to Genesis, you would not copy over a file from Genesis unless you really know what you are doing.
A better option would be to copy over a file from another child theme like a archive-portfolio.php file, rename it according to the information on the Codex https://codex.wordpress.org/Template_Hierarchy.
Then you can modify/add/remove the code in the file.
Or use a custom function in your child theme with conditional tag.
Using filters is the correct method and best practice when it comes to modifying default Genesis theme framework functions via a child theme.
Themes like Twenty Fourteen are coded differently to Genesis and enable you to copy over to a child theme and modify.
For example, if you where using Twenty Fourteen, you would copy over the file and change this code:
the_title( '<h1 class="entry-title">', '</h1>' );
This is what you need to do with Genesis using a filter. You can find examples in the Code Snippets section.
I've written about how to create archive and single page files and templates on my blog several times.
May 5, 2014 at 6:41 pm #103776
Thanks, Brad. Yes, I know that it works differently with Genesis; I'm just trying to understand how. I appreciate the information you've shared and will read up on filters.
PattyMay 5, 2014 at 9:09 pm #103789
Link to your site please.
- The forum ‘General Discussion’ is closed to new topics and replies.