• 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

Genesis Templates or WordPress templates?

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 › General Discussion › Genesis Templates or WordPress templates?

This topic is: resolved

Tagged: custom template, page template

  • This topic has 12 replies, 5 voices, and was last updated 5 years, 4 months ago by Brad Dalton.
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • October 15, 2017 at 6:59 pm #212565
    danbru1989
    Member

    I've been designing on the Genesis framework for about one year now and something that I can't figure out is when it is best to use a Genesis template or a WordPress template...

    I have searched around and can't find anywhere that compares the two options in detail. What are your thoughts?

    I often use a WordPress template file on a front landing page where I know that I want to veer from the standard layout and add a lot of HTML to showcase the brand. Rather than placing all my HTML in the WYSIWYG page content area I believe it best to create a WordPress template file.

    On the other hand, if I just have to tweak a little PHP code on a particular page, then I would go with a Genesis template.

    What are some rules to follow with this?

    October 16, 2017 at 6:39 am #212568
    Victor Font
    Moderator

    This may come as a bit of a surprise, but Genesis templates are WordPress templates. As a theme framework, Genesis provides wrappers to WordPress functions and additional functionality that makes the entire theme building process easier and more robust. When you work outside of the Genesis Framework, you lose its benefits such as accessibility, schema.org markup, and dynamically built filters. I've been working with Genesis for a long time and building apps for over 30 years. I can think of no reason whatsoever to work around its functionality.

    One year is not a long time to be working with Genesis. It's barely enough time to learn the inner workings of the framework and how all of the different parts work together. If I may make a suggestion, perhaps a visit to https://knowthecode.io will help you gain further understanding.


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    October 16, 2017 at 7:04 am #212570
    danbru1989
    Member

    I understand what you are saying and see the value of that approach.

    My PHP knowledge is at a beginners level... How would you go about adding a lot of HTML code to a Genesis template file?

    The only way that I have found is this: (but I don't believe it's standard practice)

    function bds_page_content() {
    return <<<HTML
        <div class="page-content-wrapper">
        <p>This is my static HTML content</p>
        </div>
    HTML;
    }
    October 16, 2017 at 7:58 am #212572
    carasmo
    Participant

    If you sign up with KnowTheCode.io, you'll learn a better way.

    Also read Bill Erickson's blog. Purchase the Studio Press theme developer package, learn from the code in those themes. I dig code by Robert Neu http://robneu.com/ who works on Foodie Pro, Brunch Pro and the Cooked Plugin.


    Genesis Theme Customization and Help

    October 16, 2017 at 9:27 am #212574
    danbru1989
    Member

    Any thoughts on this? I've heard that it is a "dirty hack".

    <?php
    
    /*
    Template Name: About Us
    */
    
    add_action( 'genesis_entry_content', 'bds_about_us_content' );
    
    function bds_about_us_content() {
      ?>
      <div class="page-content">
         <p>This is the information about us!</p>
      </div>
      <?php
    }
    
    genesis();
    October 16, 2017 at 9:47 am #212576
    carasmo
    Participant

    Why would someone do that? It's lazy. Just use the editor and/or custom fields so the client doesn't have to mess with html.


    Genesis Theme Customization and Help

    October 16, 2017 at 9:52 am #212577
    danbru1989
    Member

    You'd do it if you don't want the client to be changing anything at all. Hardcode it into a template file.

    October 16, 2017 at 10:28 am #212579
    carasmo
    Participant

    You don't need to do that to prevent the client changing anything. https://wordpress.org/plugins/user-role-editor/


    Genesis Theme Customization and Help

    October 16, 2017 at 10:33 am #212580
    danbru1989
    Member

    I would go your route if I had to lock down a lot of things, but if it is just protecting my code on a simple page then it would be better to not add another plugin. I try to stay under about 5 plugins.

    October 16, 2017 at 1:38 pm #212581
    tarmadillo
    Participant

    You'd do it if you don't want the client to be changing anything at all. Hardcode it into a template file.

    EWWWWWWW. My first WordPress client had their previous developer pull this. ALL their page content was hard coded into the theme files and written in PHP echos and span classes. It was worse than the plugin lock you get when using page builders. Changing the theme resulted in a completely blank website, no content. I had to resort to copy and paste out of the browser.


    https://armadillowebdesign.com

    October 16, 2017 at 2:07 pm #212584
    carasmo
    Participant

    What he said ^.


    Genesis Theme Customization and Help

    October 16, 2017 at 4:37 pm #212586
    danbru1989
    Member

    Thank you all for your input. I appreciate it!

    October 25, 2017 at 5:46 am #212924
    Brad Dalton
    Participant

    Here's the basics of a page template for Genesis

    <?php
    
    /*
    Template Name: Custom
    */
    
    // Add custom body class to the head
    add_filter( 'body_class', 'add_body_class' );
    function add_body_class( $classes ) {
       $classes[] = 'custom';
       return $classes;
    }
    
    
    
    // Force full width page layout
    add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
    
    
    
    genesis();
    

    Tutorials for StudioPress Themes.

  • Author
    Posts
Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Genesis Templates or WordPress templates?’ is closed to new replies.

CTA

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

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 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