Question

I'm creating a site where rarely, but it will happen, I will have a guest author. I looked at plugin for author boxes and none are basic enough for my needs.

I'm creating some basic CSS styles and hard coding an author box for those few times I need to worry about this.

What code would I put in a post to pull an avatar based on an email address? Seems like this is possible with a small snippet of php. Is there an easy way to create a shortcode to do it for me? I've only dabbled in WordPress modifications.

Thanks.

Était-ce utile?

La solution

What I would do is use the Shortcode API:

http://codex.wordpress.org/Shortcode_API

With this, you can register a shortcode like

[author_avatar]

This shortcode would be simple, it would just use get_avatar()

http://codex.wordpress.org/Function_Reference/get_avatar

Based on the Shortcode API, you could essentially pass parameters through the shortcode, example:

[author_avatar email="author.name@domain.com" size="32"]

Than use wp_enqueue_style() to pull in your css

http://codex.wordpress.org/Function_Reference/wp_enqueue_style

I apologies for being brief I hope this is useful.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top