WordPress pull avatar into post - wordpress

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.

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.

Related

How do I call a plugin in a custom page for wordpress?

So I am trying to do this and I don't know how. I have a wordpress powered website with a plugin called "frontier-post" in it. This plugin makes a new front-end post submission. The way to use it is to put the shortcode "[frontier-post]" in any post in my wordpress page and that page turns into this.
I want to make a custom page for myself, where I can have the content created by this plugin there too. So I do not want it to be a post in my wordpress, but lets say at a corner in the custom page. I have searched and found these but the suggestions there would not work. I am able to include the wordpress so that the custom page has access to posts, etc. but even using this
echo do_shortcode('[frontier-post]');
would not help me. (even if header is included)
These are the similar things i found:
Wordpress/PHP - How to use plugins outside wordpress-powered pages?
Need Help for my Custom Page Template
I would really appreciate it if you could help me with this.
If you are creating a PHP page that isn't going to be rendered inside WordPress, you can't use a Plugin of the WordPress engine to accomplish what you are wanting to build. (As the accepted answer to one of the pages you link to indicates).
Instead, you might be able to use the json-api plugin and have your custom page query it for the data. While it won't render the shortcode, it will give you the raw data to work with.
http://wordpress.org/plugins/json-api/
Edit:
Based on a comment, your do_shortcode should work...just try it without the square brackets.

Writing a wordpress plugin: add_meta_box vs. add_settings_field?

I'm writing a custom wordpress plugin and trying to incorporate some functionality from a third-party plugin. That plugin seems to use add_meta_box to create the fields for settings options on the plugin admin pages. I searched the entire source code of the plugin for add_settings_field and it doesn't occur once. Are the two functions basically interchangeable? From the WP Codex, it seems that add_meta_box is primarily for the purpose of adding "a custom section to the post and page editing screens" -- i.e. not so much intended for the admin settings/options forms. On the other hand, the 3rd-party plugin seems to work very well, which is why I'm borrowing from it...
So in short my question is this: can someone please explain correct usage for the add_meta_box and add_settings_field functions? Thanks! Please let me know if anything about this question is unclear and I will do my best to rephrase.
This is a settings field (Slug):
This is 2 Meta Boxes (publish and categories):

What is wordpress shortcode? what is the difference between the code in the codex?

Im newbie in WordPress and I want to make my own theme using child theme. I am confused about the shortcode? Can anyone explain to me what is a shortcode? Because I'm using php code that I get to the codex?
If I understand your question, you misunderstand something pretty fundamental.
PHP is a programming language which is used to write WordPress, and WordPress Themes and Plugins. And shortcode callback functions.
A Shortcode is is not a programming language. It is more like BBCode or Markdown. It is way to insert lengthy or complicated content easily, without having to write it out every time.
PHP and "shortcode" are not interchangeable. They aren't the same thing and you don't use them the same way.
Shortcode is a markup language which can be used in WordPress pages to incorporate plugins and other types of code. Shortcode consists of brackets encapsulating a keyword and variables, which is used to identify it as a place on the page where other code is supposed to be placed before the page is displayed.

Wordpress custom meta box to include background picture

I am designing a WordPress theme and would like to post recipes. The text (ingredients, etc.) will go into the main post window, but I would like to include a picture, which should become the background picture of the whole window. The usual Upload/Insert includes the picture into the post. Is there any better way of associating a picture to a post? Should I use the Custom Fields for this?
To make your life easy i recommend a plugin for that The Advanced custom fields
Its very easy to use. You can get full documentation here
This plugin always save my development time.
Hope it will help
Check out WP-Alchemy.
http://www.farinspace.com/wpalchemy-metabox/
It's incredible. It can be implemented into a plugin, or a theme. I have used it and it works great!
Otherwise, the term you are looking for is "Wordpress Custom Meta Box" throw that in google, and you will get more info than you probably wanted.
If you are more of a wordpress codex junkie, check out the add_meta_box function.
http://codex.wordpress.org/Function_Reference/add_meta_box

Which WP plugin for enabling users add posts without registration?

I would like to know which WP plugin should I choose to allow every user who come to my page to add a post to my page form the frontend.
He just click on a button add a new post or something like that. Than a form appear and he inserts the title and uploads an image.
After that its published as a post.
Is there a solution like this available for WP?
Thanks in advance.
From what I know, there is no existing plugin doing it as you need. Even if it existed, I wouldn't recommend it's use for security reasons; it is hard to follow every uses and make sure visitors would post the way you want.
You are definitely better to code it by your own, and it's quite simple using the wp_insert_post function. This function will work anywhere you put it inside Wordpress (no need to build a plugin from scratch), so a simple form with validation would make it.
Hope it guides you on what you're looking for.

Resources