Community Forums › Forums › Archived Forums › General Discussion › Genesis Templates or WordPress templates?
Tagged: custom template, page template
- This topic has 12 replies, 5 voices, and was last updated 6 years, 11 months ago by Brad Dalton.
-
AuthorPosts
-
October 15, 2017 at 6:59 pm #212565danbru1989Member
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 #212568Victor FontModeratorThis 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 #212570danbru1989MemberI 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 #212572carasmoParticipantIf 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.
October 16, 2017 at 9:27 am #212574danbru1989MemberAny 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 #212576carasmoParticipantWhy 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.
October 16, 2017 at 9:52 am #212577danbru1989MemberYou'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 #212579carasmoParticipantYou don't need to do that to prevent the client changing anything. https://wordpress.org/plugins/user-role-editor/
October 16, 2017 at 10:33 am #212580danbru1989MemberI 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 #212581tarmadilloParticipantYou'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.
October 16, 2017 at 2:07 pm #212584carasmoParticipantOctober 16, 2017 at 4:37 pm #212586danbru1989MemberThank you all for your input. I appreciate it!
October 25, 2017 at 5:46 am #212924Brad DaltonParticipantHere'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();
-
AuthorPosts
- The topic ‘Genesis Templates or WordPress templates?’ is closed to new replies.