The atom_entry WordPress PHP action fires at the end of each Atom feed item.
Usage
add_action('atom_entry', 'your_custom_function');
function your_custom_function() {
// your custom code here
}
Parameters
- None
More information
See WordPress Developer Resources: atom_entry
Examples
Add a custom footer to Atom feed items
Add a custom footer text to each Atom feed item.
add_action('atom_entry', 'add_custom_atom_footer');
function add_custom_atom_footer() {
echo '<footer>Powered by My Custom Plugin</footer>';
}
Include post view count in Atom feed items
Display the post view count at the end of each Atom feed item.
add_action('atom_entry', 'add_view_count_to_atom_feed');
function add_view_count_to_atom_feed() {
global $post;
$views = get_post_meta($post->ID, 'views', true);
echo "<postViews>$views</postViews>";
}
Append custom category data to Atom feed items
Add custom category information to each Atom feed item.
add_action('atom_entry', 'add_custom_category_data');
function add_custom_category_data() {
global $post;
$categories = get_the_category($post->ID);
foreach ($categories as $category) {
echo "<customCategory>{$category->name}</customCategory>";
}
}
Add a featured image URL to Atom feed items
Include the featured image URL of each post in the Atom feed item.
add_action('atom_entry', 'add_featured_image_url_to_atom_feed');
function add_featured_image_url_to_atom_feed() {
global $post;
$featured_image_url = get_the_post_thumbnail_url($post->ID);
echo "<featuredImageUrl>$featured_image_url</featuredImageUrl>";
}
Show the post author’s email in Atom feed items
Display the author’s email address at the end of each Atom feed item.
add_action('atom_entry', 'add_author_email_to_atom_feed');
function add_author_email_to_atom_feed() {
global $post;
$author_email = get_the_author_meta('user_email', $post->post_author);
echo "<authorEmail>$author_email</authorEmail>";
}