WordPress.org

Ready to get started?Download WordPress

Forums

Path
[resolved] Path-Child and Functions.php (7 posts)

  1. Lane Lester
    Member
    Posted 1 year ago #

    I understand the advantage of child themes and would really like to use them. But I almost always run into a snag I can't handle and go back to my old bad practice of editing the main files.

    Thank you for including a child theme in this distribution. I have it activated and for some things I was able to do my editing there. I hit a snag when I wanted to change some code in functions.php.

    I was trying to get rid of the gravitar images that were showing up with author names. I thought if I eliminated get_avatar from function path_author_box() at line 400 of functions.php, that would do the trick. So I copied and edited just the path_author_box() in the child functions.php. That didn't work, and I don't remember the error.

    Even eliminating get_avatar from the main file didn't get rid of the gravitar images. I finally tracked down all instances of get_avatar and eliminated the difficulty.

    What is the right way to make a change in the child functions.php so it will work?

    BTW, I'm using this theme in a pro bono installation, and I can't afford the $29 to get the documentation.

    Lane

    http://wordpress.org/extend/themes/path/

  2. Sami Keijonen
    Member
    Theme Author

    Posted 1 year ago #

    You are absolutely right: do not ever modify parent theme files, you will lose them when you update the theme.

    I would just hide avatar adding this line in child theme style.css.

    .avatar {
        display: none;
    }

    This will hide avatars everywhere. If you just want to hide them from 'Author box' add this in child theme style.css.

    .author-profile .avatar {
        display: none;
    }
  3. Andrew Bartel
    Member
    Posted 1 year ago #

    I think the issue you're running into is that a child theme's functions.php file is loaded prior to the parent theme's functions.php. So, it won't override it by default.

    Sami's suggestion to use css is probably the right way to go without diving any of us actually diving into the code.

  4. Sami Keijonen
    Member
    Theme Author

    Posted 1 year ago #

    If you really want to do it via child themes functions.php, remove Author box first. Put this inside setup function.

    /* Remove an author box after singular posts. */
    	remove_action( "{$prefix}_singular-post_after_singular", 'path_author_box', 11 );

    An roll your own author box. Of course you can copy-paste original code. I would still recommend just hide avatar with little css.

  5. Lane Lester
    Member
    Posted 1 year ago #

    I decided to try to do the right thing, and it seems to have worked. I updated to Path 0.1.3 (eliminating my edited files) and added this to the child style.css:
    .avatar {
    display: none;
    }

    I think the theme is no longer going to gravatar.com, something I want to avoid.

    Lane

  6. Sami Keijonen
    Member
    Theme Author

    Posted 1 year ago #

    I think the theme is no longer going to gravatar.com, something I want to avoid.

    That is not the case. CSS only hides avatar.

    But since you want to disable avatars in your site all together, do this.

    Go to Settings >> Discussion. In there click Don’t show Avatars. That's WP functionality and you won't have to worry about gravatar.com again.

  7. Lane Lester
    Member
    Posted 1 year ago #

    Thanks for the tip about Discussion; I've made that change now.

    And thank you for Path. I'm very impressed with what I've seen so far, and I know I have not yet explored all of its capabilities.

    Lane

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags