Strict Standards: Redefining already defined constructor for class bbdb in /home/themes/public_html/forums/bb-includes/db-mysql.php on line 12

Strict Standards: Declaration of BB_Walker_Blank::start_lvl() should be compatible with BB_Walker::start_lvl($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127

Strict Standards: Declaration of BB_Walker_Blank::end_lvl() should be compatible with BB_Walker::end_lvl($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127

Strict Standards: Declaration of BB_Walker_Blank::start_el() should be compatible with BB_Walker::start_el($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127

Strict Standards: Declaration of BB_Walker_Blank::end_el() should be compatible with BB_Walker::end_el($output) in /home/themes/public_html/forums/bb-includes/classes.php on line 1127
Adding Gravar to Posts « ThemeShaper Forums

ThemeShaper Forums » Thematic

[closed]

Adding Gravar to Posts

(6 posts)
  • Started 3 years ago by RedStarWeb
  • Latest reply from RedStarWeb
  • This topic is not resolved
  1. RedStarWeb
    Member

    I would like to add author gravatar to all my posts, but I'm having a hard time finding a way to do this. I assume I need to filter the post meta data, but I'm not sure where to start.

    Posted 3 years ago #

  2. Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512


    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512
    helgatheviking

    Moderator

    try reading the primer i just wrote for someone else on how to add things to hooks and how to filter things

    http://forums.themeshaper.com/topic/need-help-understanding-actions-vs-filters-and-changing-post-meta-and-utility#post-22638

    Posted 3 years ago #
  3. RedStarWeb
    Member

    Fantastic resouce, Helga. I think I'm on the right track, but I'm missing something. Here's what I've got right now:

    // Add Author Gravatar to Posts

    function author_gravatar() {
    return '$postmeta' . 'echo get_avatar($author_email, '80')';
    }
    add_filter('thematic_postheader' . 'author_gravatar');

    Posted 3 years ago #
  4. RedStarWeb
    Member

    Okay, I've got it displaying now. I still need to fiddle with styling, and figure out how to keep it from displaying on pages, but if anyone's interested here's what I did:

    // Add Author Gravatar

    function author_gravatar($postmeta) {
    $author_avatar = get_avatar( get_the_author_email(), '80' );
    $postmeta .= $author_avatar;
    return $postmeta;
    }

    add_filter('thematic_postheader', 'author_gravatar');

    Posted 3 years ago #

  5. Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512


    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 440

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 510

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/themes/public_html/forums/bb-includes/kses.php on line 512
    helgatheviking

    Moderator

    glad that helped.

    to not display on pages simply wrap the insides w/ a conditional tag

    is_page() test for whether it is a page or not
    ! makes it negative.... so NOT a page.

    codex.wordpress.org/Conditional_Tags

    function bacon(){
      if(!is_page(){
        echo "sooo not a page. let's have bacon";
      }
    }
    add_action('thematic_before','bacon');
    Posted 3 years ago #
  6. RedStarWeb
    Member

    Very helpful! Now I just need to find the best way to style it. Wrapping the avatar in a div seems to work, but it seems like there's probably a better way of doing it.

    Current output:

    // Add Author Gravatar to Posts

    function author_gravatar($postmeta) {
    $author_avatar = '<div class="author-avatar">'; // Trying to format the image by containing it in a div. Not sure if thats the right move.
    $author_avatar .= get_avatar( get_the_author_email(), '80' );
    $author_avatar .= '</div>';
    if(!is_page() ) {
    $postmeta .= $author_avatar;
    }
    return $postmeta;

    add_filter('thematic_postheader', 'author_gravatar');
    }

    add_filter('thematic_postheader', 'author_gravatar');

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.


Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method GA_Filter::spool_analytics() should not be called statically in /home/themes/public_html/forums/bb-includes/wp-functions.php on line 586

Strict Standards: Non-static method GA_Filter::spool_this() should not be called statically in /home/themes/public_html/forums/my-plugins/googleanalytics.php on line 183