The atom_head WordPress PHP action fires just before the first Atom feed entry.
Usage
add_action('atom_head', 'your_custom_function');
function your_custom_function() {
// your custom code here
}
Parameters
- None
More information
See WordPress Developer Resources: atom_head
Examples
Add a custom XML namespace
Add a custom XML namespace to the Atom feed head.
add_action('atom_head', 'add_custom_xml_namespace');
function add_custom_xml_namespace() {
echo 'xmlns:custom="http://example.com/custom-namespace"';
}
Insert a custom logo
Include a custom logo URL in the Atom feed head.
add_action('atom_head', 'add_custom_logo_to_atom_feed');
function add_custom_logo_to_atom_feed() {
$logo_url = 'https://example.com/path/to/logo.png';
echo "<logo>$logo_url</logo>";
}
Add custom stylesheet
Add a custom stylesheet URL to the Atom feed head.
add_action('atom_head', 'add_custom_stylesheet_to_atom_feed');
function add_custom_stylesheet_to_atom_feed() {
$stylesheet_url = 'https://example.com/path/to/stylesheet.css';
echo "<?xml-stylesheet href='$stylesheet_url' type='text/css'?>";
}
Insert a custom favicon
Include a custom favicon URL in the Atom feed head.
add_action('atom_head', 'add_custom_favicon_to_atom_feed');
function add_custom_favicon_to_atom_feed() {
$favicon_url = 'https://example.com/path/to/favicon.ico';
echo "<icon>$favicon_url</icon>";
}
Add custom feed information
Insert custom feed information into the Atom feed head.
add_action('atom_head', 'add_custom_feed_information');
function add_custom_feed_information() {
echo '<customInfo>Some custom information about the feed</customInfo>';
}