Community Forums › Forums › General Genesis Framework Discussions › Trying to create a single page child theme
Tagged: front-page.php, nav menu
- This topic has 5 replies, 3 voices, and was last updated 2 years, 9 months ago by clarabrandt.
-
AuthorPosts
-
April 8, 2022 at 3:12 pm #504985CreatiqueMediaParticipant
Hello, I am trying to create a single page child theme using Genesis Sample and what I am trying to do is to create IDs to link to from the navigation menu.
For instance, I have an About Me menu item on the navigation and I want to create an About Me section. Then, when the About Me menu item is clicked, I want it to simply scroll to the About Me section.
I have the About Me navigation menu item already created, but now I am trying to figure out how to create the About Me section to scroll to.
I am presuming I create this using PHP in the functions.php file, but I have searched all over and cannot find any info on how to go about doing this.
I am new to Genesis, but not to Web Development. I know HTML, CSS, JavaScript/JQuery, and I am decent with PHP, but no so well versed in Genesis or WordPress development, but that's why I am diving into this right now.
Any help would be great!
Thank you very much!
http://N/AApril 8, 2022 at 6:39 pm #504987CreatiqueMediaParticipantOkay, after more research, I discovered that I needed to create a front-page.php file and I added the following PHP code to it:
/** * Adds markup for front page widget areas. * * @since 1.0.0 */ function freelancer_pro_front_page_widgets() { echo '<h2 class="screen-reader-text">' . esc_html__( 'Main Content', 'freelancer-pro' ) . '</h2>'; genesis_widget_area( 'front-page-1', [ 'before' => '<div id="front-page-1" class="front-page-1" tabindex="-1"><div class="image-section"><div class="flexible-widgets widget-area' . freelancer_pro_widget_area_class( 'front-page-1' ) . '"><div class="wrap">', 'after' => '</div></div></div></div>', ] ); genesis_widget_area( 'front-page-2', [ 'before' => '<div id="front-page-2" class="front-page-2" tabindex="-1"><div class="solid-section"><div class="flexible-widgets widget-area' . freelancer_pro_widget_area_class( 'front-page-2' ) . '"><div class="wrap">', 'after' => '</div></div></div></div>', ] ); genesis_widget_area( 'front-page-3', [ 'before' => '<div id="front-page-3" class="front-page-3" tabindex="-1"><div class="image-section"><div class="flexible-widgets widget-area' . freelancer_pro_widget_area_class( 'front-page-3' ) . '"><div class="wrap">', 'after' => '</div></div></div></div>', ] ); genesis_widget_area( 'front-page-4', [ 'before' => '<div id="front-page-4" class="front-page-4" tabindex="-1"><div class="solid-section"><div class="flexible-widgets widget-area' . freelancer_pro_widget_area_class( 'front-page-4' ) . '"><div class="wrap">', 'after' => '</div></div></div></div>', ] ); genesis_widget_area( 'front-page-5', [ 'before' => '<div id="front-page-5" class="front-page-5" tabindex="-1"><div class="image-section"><div class="flexible-widgets widget-area' . freelancer_pro_widget_area_class( 'front-page-5' ) . '"><div class="wrap">', 'after' => '</div></div></div></div>', ] ); genesis_widget_area( 'front-page-6', [ 'before' => '<div id="front-page-6" class="front-page-6" tabindex="-1"><div class="solid-section"><div class="flexible-widgets widget-area' . freelancer_pro_widget_area_class( 'front-page-6' ) . '"><div class="wrap">', 'after' => '</div></div></div></div>', ] ); genesis_widget_area( 'front-page-7', [ 'before' => '<div id="front-page-7" class="front-page-7" tabindex="-1"><div class="image-section"><div class="flexible-widgets widget-area' . freelancer_pro_widget_area_class( 'front-page-7' ) . '"><div class="wrap">', 'after' => '</div></div></div></div>', ] ); }
I then added the following to my functions.php file to register the aforementioned frontpage widget sections:
genesis_register_sidebar( array( 'id' => 'front-page-1', 'name' => __( 'Front Page 1', 'freelancer-pro' ), 'description' => __( 'This is the front page 1 section.', 'freelancer-pro' ), ) ); genesis_register_sidebar( array( 'id' => 'front-page-2', 'name' => __( 'Front Page 2', 'freelancer-pro' ), 'description' => __( 'This is the front page 2 section.', 'freelancer-pro' ), ) ); genesis_register_sidebar( array( 'id' => 'front-page-3', 'name' => __( 'Front Page 3', 'freelancer-pro' ), 'description' => __( 'This is the front page 3 section.', 'freelancer-pro' ), ) ); genesis_register_sidebar( array( 'id' => 'front-page-4', 'name' => __( 'Front Page 4', 'freelancer-pro' ), 'description' => __( 'This is the front page 4 section.', 'freelancer-pro' ), ) ); genesis_register_sidebar( array( 'id' => 'front-page-5', 'name' => __( 'Front Page 5', 'freelancer-pro' ), 'description' => __( 'This is the front page 5 section.', 'freelancer-pro' ), ) ); genesis_register_sidebar( array( 'id' => 'front-page-6', 'name' => __( 'Front Page 6', 'freelancer-pro' ), 'description' => __( 'This is the front page 6 section.', 'freelancer-pro' ), ) ); genesis_register_sidebar( array( 'id' => 'front-page-7', 'name' => __( 'Front Page 7', 'freelancer-pro' ), 'description' => __( 'This is the front page 7 section.', 'freelancer-pro' ), ) );
I think this is what I was looking for so far.
April 8, 2022 at 6:45 pm #504988CreatiqueMediaParticipantThe problem I have now is for content to display when I add widget content to the widgets themselves. For instance, when I add an image to the Front Page 1 section, it does not display on the frontpage.
I am assuming I need to somehow tell WordPress to activate these widget areas, but I am not aware of how to do that.
Any help here would be great!
Thanks
April 8, 2022 at 9:35 pm #504989Brad DaltonParticipantTake a look at how this theme is coded. https://www.studiopress.com/themes/altitude/#demo-full
April 11, 2022 at 6:38 am #505013clarabrandtParticipantYou will Create a Child Theme in WordPress, Step by Step
Step 1: Create a child theme folder.
Step 2: Create a stylesheet for your child theme.
Step 3: Enqueue the parent and child themes' stylesheets.
Step 4: Install and activate your child theme.
Step 5: Customize your child theme. -
AuthorPosts
- You must be logged in to reply to this topic.