How to make *simple* custom archive page in a Genesis child theme

Community Forums Forums General Discussion How to make *simple* custom archive page in a Genesis child theme

This topic is: resolved

This topic contains 5 replies, has 2 voices, and was last updated by  braddalton 5 months, 2 weeks ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #103749

    pattyayers
    Participant
    Post count: 19

    Hello all,

    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,

    Patty

    #103762

    braddalton
    Participant
    Post count: 10208

    You would need to filter the title conditionally and remove the code which generates the link which looks like this:

    [php]
    <a href="’ . get_permalink() .
    [/php]

    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.


    #103766

    pattyayers
    Participant
    Post count: 19

    Hi Brad,

    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.

    http://make.wordpress.org/docs/theme-developer-handbook/advanced-theme-topics/child-themes/

    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.

    Best,
    Patty

    • This reply was modified 5 months, 2 weeks ago by  pattyayers.
    • This reply was modified 5 months, 2 weeks ago by  pattyayers.
    • This reply was modified 5 months, 2 weeks ago by  pattyayers.
    • This reply was modified 5 months, 2 weeks ago by  pattyayers.
    #103774

    braddalton
    Participant
    Post count: 10208

    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:

    To this
    [php]
    the_title( ‘<h1 class="entry-title">’, ‘</h1>’ );
    [/php]

    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.


    #103776

    pattyayers
    Participant
    Post count: 19

    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.

    Best,
    Patty

    #103789

    braddalton
    Participant
    Post count: 10208
Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.