Community Forums › Forums › Archived Forums › General Discussion › Modern Portfolio
Tagged: custom template, modern portfolio
- This topic has 5 replies, 2 voices, and was last updated 11 years, 1 month ago by SimplyAA.
-
AuthorPosts
-
October 18, 2013 at 2:17 pm #67424SimplyAAMember
I am using the Modern Portfolio theme. I wanted each page to have a unique "About" widget so I created a new widget. For example on this page: http://angelaandrews.me/dolphins/ I am using the dolphin template I created. The widget works great but I now want to display the page content after and can't seem to figure it out.
I'm sure this is something simple but whatever I try doesn't work. I have this:
<?php /** * Controls the dolphin page output. */ /*Template Name: Dolphin Page*/ add_action( 'wp_enqueue_scripts', 'mp_enqueue_scripts' ); /** * Enqueue Scripts */ function mp_enqueue_scripts() { if ( is_active_sidebar( 'about-dolphins' ) ) { wp_enqueue_script( 'scrollTo', get_stylesheet_directory_uri() . '/js/jquery.scrollTo.min.js', array( 'jquery' ), '1.4.5-beta', true ); wp_enqueue_script( 'localScroll', get_stylesheet_directory_uri() . '/js/jquery.localScroll.min.js', array( 'scrollTo' ), '1.2.8b', true ); wp_enqueue_script( 'scroll', get_stylesheet_directory_uri() . '/js/scroll.js', array( 'localScroll' ), '', true ); } } add_action( 'genesis_meta', 'mp_home_genesis_meta' ); /** * Add widget support for homepage. If no widgets active, display the default loop. * */ function mp_home_genesis_meta() { if ( is_active_sidebar( 'about-dolphins' ) ) { // Force content-sidebar layout setting add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); // Add mp-home body class add_filter( 'body_class', 'mp_body_class' ); function mp_body_class( $classes ) { $classes[] = 'mp-home'; return $classes; } // Remove the navigation menus remove_action( 'genesis_after_header', 'genesis_do_nav' ); remove_action( 'genesis_after_header', 'genesis_do_subnav' ); // Remove the default Genesis loop remove_action( 'genesis_loop', 'genesis_do_loop' ); // Add homepage widgets add_action( 'genesis_loop', 'mp_homepage_widgets' ); } } function mp_homepage_widgets() { genesis_widget_area( 'about-dolphins', array( 'before' => '<div id="about-dolphins"><div class="wrap">', 'after' => '</div></div>', ) ); } genesis(); ?>
I tried taking out the "remove default genesis loop" section above but all I get is the content of the page, not styled, and no "About" widget.
Would appreciate any help. Thank you
Angela
October 19, 2013 at 2:24 am #67597Sridhar KatakamParticipantDo you want to add a widget section above content sidebar wrap on static Pages?
October 19, 2013 at 10:45 am #67677SimplyAAMemberIf that would be easiest. How can I lit the widget to a specific page?
Angela
October 20, 2013 at 8:39 am #67822Sridhar KatakamParticipantAdd this in functions.php:
genesis_register_sidebar( array( 'id' => 'pages_about', 'name' => __( 'Pages About', 'mp' ), 'description' => __( 'This is the About section for Pages', 'mp' ), ) ); add_action ( 'genesis_before_content_sidebar_wrap', 'sk_pages_about_section' ); function sk_pages_about_section() { if ( is_page() ) { genesis_widget_area( 'pages_about', array( 'before' => '<div id="pages-about"><div class="wrap">', 'after' => '</div></div>', ) ); } }
and this in style.css:
#pages-about { margin-bottom: 3rem; line-height: 1.625; }
Now drag widgets into 'Pages About' sidebar. You can limit what widget appears on what Page using a plugin like Widget Logic.
October 20, 2013 at 4:22 pm #67903SimplyAAMemberI've added a widget (different than above)
// Register About Page Intro widget genesis_register_sidebar( array( 'id' => 'about-intro', 'name' => __( 'About Intro', 'mp' ), 'description' => __( 'This is the intro section of about page.', 'mp' ), ) ); // Hook about intro to about page only add_action( 'genesis_before_content_sidebar_wrap', 'about_intro', 9 ); function about_intro() { if ( is_page('about-angela') && is_active_sidebar( 'about-intro' ) ) { echo '<div class="about-intro"><div class="wrap">'; dynamic_sidebar( 'about-intro' ); echo '</div></div>'; } }
It seems to work okay except it's not going all the way across the page like I want it. It should look like the home page one here: http://angelaandrews.me/. Do you know how I can get to go across full length of the page?
Angela
October 20, 2013 at 4:47 pm #67905SimplyAAMemberI just figured it out: I needed to change my hook from:
genesis_before_content_sidebar_wrap
to:
genesis_after_headerThanks for your help.
Angela
-
AuthorPosts
- The topic ‘Modern Portfolio’ is closed to new replies.