Modern Portfolio "About" widget

Community Forums Forums Design Tips and Tricks Modern Portfolio "About" widget

This topic is: resolved

Tagged: 

This topic contains 20 replies, has 3 voices, and was last updated by  IamRob 1 year ago.

Viewing 15 posts - 1 through 15 (of 21 total)
  • Author
    Posts
  • #51411

    IamRob
    Participant
    Post count: 8

    Hi all,
    I’d like to add the “about” widget inside the other page of this template. Anyone can help me with it?

    Thank you,
    Rob

    #51433

    braddalton
    Participant
    Post count: 8896

    Please clarify.

    inside the other page of this template

    Do you want to add a widget inside a page you create for your about page rather than the home page?


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #51687

    IamRob
    Participant
    Post count: 8

    Exactly! I’d like to have the same widget even inside a page I’ve created, not only in the home page.

    #51709

    braddalton
    Participant
    Post count: 8896

    Try this: You can change the name of the page slug or use the page i.d rather than the page slug in the code.
    [php]
    if ( is_page(’007′) && is_active_sidebar(‘page-widget’ ) ) {
    [/php]
    This example uses contact-page in the conditional tag.
    [php]
    if ( is_page(‘about-page’) && is_active_sidebar( ‘page-widget’ ) ) {
    [/php]

    Please copy this code from the view raw link and paste it at the end of your child themes functions.php file using a text editor like Notepad++.

    https://gist.github.com/braddalton/6049246


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #51717

    IamRob
    Participant
    Post count: 8

    I tried but it doesn’t works. The widget doesn’t appear inside the page.

    #51719

    braddalton
    Participant
    Post count: 8896

    You can change the hook.

    Try the genesis_after_post_title hook

    So change this line:
    [php]
    add_action( ‘genesis_before_content_sidebar_wrap’, ‘wpsites_page_widget’, 5 );
    [/php]
    To this:
    [php]
    add_action( ‘genesis_after_post_title’, ‘wpsites_page_widget’, 5 );
    [/php]

    If you where wanting a widget in the middle of the content area, you would need to use a plugin like, widgets on pages. or shortcode any widget.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #51722

    IamRob
    Participant
    Post count: 8

    Yes, I did.

    This is the website: http://www.italianluxuryweddings.com/wordpress/

    I’d like to have in every page the same header. The header with the logo and the image is the widget “ABOUT” of the Modern Portfolio Child Theme. I simply putted the logo inside the widget and changed the background of the #about section inside the style.css

    This is the code I added to the function.php page, but it doesn’t works.

    genesis_register_sidebar( array(
    ‘id’ => ‘page-widget’,
    ‘name’ => __( ‘Page Widget’, ‘wpsitesdotnet’ ),
    ‘description’ => __( ‘Contact page widget.’, ‘wpsitesdotnet’ )
    ) );
    /**
    * @author Brad Dalton – WP Sites
    * @example http://wp.me/p1lTu0-9Jr
    */
    add_action( ‘genesis_after_header’, ‘wpsites_page_widget’, 5 );
    function wpsites_page_widget() {
    if ( is_page(‘about-me’) && is_active_sidebar( ‘page-widget’ ) ) {
    echo ‘<div class=”widget”>’;
    dynamic_sidebar( ‘page-widget’ );
    echo ‘</div><!– end .page-widget –>’;

    }
    }

    #51724

    ModernMuse
    Participant
    Post count: 54

    Rob,

    What is the page name? That could be the problem. In Brad’s example, it’s /about-me/.

    Double-check this line in the functions file and edit with your own page name:

    [php]if ( is_page(‘about-page’) && is_active_sidebar( ‘page-widget’ ) ) {[/php]


    #51726

    ModernMuse
    Participant
    Post count: 54

    Sorry, Brad’s example is actually /about-page/. Hopefully you understand what I meant… ;)


    #51727

    IamRob
    Participant
    Post count: 8

    The page is: http://www.italianluxuryweddings.com/wordpress/about-me

    I think I wrote the right name inside the code.

    #51731

    ModernMuse
    Participant
    Post count: 54

    Not sure why your code doesn’t work.

    The code below (with your page name of /about-me/) should add a custom widget directly below the header / above the nav bar:

    Link: https://gist.github.com/ModernMuse/f4a3c3ac4d5494a85518


    #51732

    braddalton
    Participant
    Post count: 8896

    You are right Rob. My bad. The WordPress Codex is wrong (Proof) and i should have tested the code.

    Please remove the single quotes/apostrophes from the page slug and it will work. Tested locally on your theme.

    Otherwise, please use the page i.d for your about me page. Its a bit sensitive to page names and slugs however i’d’s always seem to work.

    Sincere apologies and love your site. Amazing images.
    [php]
    if ( is_page(about-me) && is_active_sidebar( ‘page-widget’) ) {
    [/php]

    Or this:

    [php]
    if ( is_page(’278′) && is_active_sidebar( ‘page-widget’ ) ) {
    [/php]

    Might also need to try this with and without the single quotes/apostrophes.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #51733

    IamRob
    Participant
    Post count: 8

    mmm there’s something wrong:

    “Parse error: syntax error, unexpected T_STRING in /web/htdocs/www.italianluxuryweddings.com/home/wordpress/wp-content/themes/modern-portfolio/functions.php on line 81″

    I can test online, this theme it’s just an example. When it will works I’ll replace the theme in my real domain :)

    Thank you :)

    #51734

    ModernMuse
    Participant
    Post count: 54

    Ah…see, I learned something too. I was wondering why the original code didn’t work since everything looked fine.

    When I tested Rob’s code, I got a bunch of syntax errors. Now I know why.

    Hope you got it all fixed, Rob! Brad, you’re a rock star. :)


    #51739

    braddalton
    Participant
    Post count: 8896

    Its probably just the apostrophes gave turned around when you copy from embedded code. Always copy using the view raw link and paste at the end of the functions.php file using a text editor like Notepad++.

    I did notice that this causes errors when copying from within the Gist and pasting here using the shortcodes for PHP.

    The code is tested and works so i’m sure you’ll fix it very easily.

    Thanks @ModernMuseNV


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

Viewing 15 posts - 1 through 15 (of 21 total)

You must be logged in to reply to this topic.