• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Add php to archive loop

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Add php to archive loop

This topic is: not resolved
  • This topic has 1 reply, 2 voices, and was last updated 12 years, 7 months ago by marybaum.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • October 28, 2013 at 1:53 pm #69511
    leehughes
    Member

    Hi,

    I have a line of php which I need to add into my archive files just before the loop. I'm using the Minimum Pro child theme. Since the chile theme doesn't have these files and any future updates on Genesis will wipe out the code if I apply it to the Genesis core files.. what would be the best way to add this code?

    October 28, 2013 at 5:10 pm #69541
    marybaum
    Participant

    Two ways:

    1. Make a copy of the file in the Genesis core files you'd want to add it to, and put that in your Minimum Pro child theme folder, and add your code to the copy of the file.

    2. A better way would be to write an action that hooks in before the loop. Look in the Genesis Hook reference to find the name of the hook you need - perhaps genesis_before_loop.

    Then write your function something like this:

    add_action (genesis_before_loop, yourtheme_archive_before_loop);

    function yourtheme_archive_before_loop ( ) {
    if ( is_archive ) && ( function_exists( genesis_before_loop ) ) {
    //add your code here ;
    } }

    Put this function in functions.php in your child theme.

    Also, my second condition - the stuff in the parentheses after the && - may not be accurate. I humbly would ask a better coder to catch that and fix it, for the edification of us both . . .

    Hope this gets you started.

    MB


    Sharing the good news about the wonders of modern CSS and the split-step. Either one should get you moving fast. 😀

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble