Bernard Aybouts - Blog - Miltonmarketing.com

Approx. read time: 27.5 min.

Post: Extending WordPress with Plugins

Creating Events with Actions

Now that you’ve created your administrative panel and have stored your copyright text in the database, you can use it within WordPress. The most obvious place for this is in the footer of your theme.

Fortunately, most themes come with a wp_footer action that you can use to display the copyright text. But first, you need to write a function that will display the copyright text. See code below:

[html] function display_copyright()
{
if( $copyright_text = get_option(‘copyright_notices_text’ ) )
{
echo ‘

’ . $copyright_text . ‘

’;
}
}

[/html]

Because you are using an action hook to accomplish the task, there is no need to pass any arguments in the function. This is a distinct difference from filters that require an argument to be passed.

Now that you have created a semi-useful function for adding copyright text, you can add it to the theme via an action. For this, we use the action hook wp_footer like this:

[html] add_action(‘wp_footer’,’display_copyright’);[/html]

When you hook the display_copyright() function to the wp_footer hook, the function is added to the queue, to be executed when the wp_footer hook is fired in the header of the theme.

In order for this to work, the wp_footer(); function (which is a wrapper around the wp_footer action hook) must be included in the theme. The final code for this example looks like the code shown below:

[html] function display_copyright()
{
if( $copyright_text = get_option(‘copyright_notices_text’ ) )
{
echo ‘

’ . $copyright_text . ‘

’;
}
}
add_action(‘wp_footer’,’display_copyright’);[/html]

Modifying Content with Filters

The second kind of hook is called a filter. Filters, as their name suggests, take data, do something to it, and return modified data back. They are useful if you want to do something such as add an attribution notice to the end of every post or generate custom content for feeds.

As an example, you’ll see you how to add some copyright text to the end of every feed item to ensure that anyone using the feed cannot do so without some kind of enforced copyright notice (effective in combating spam blogs that scrape content and re-purpose it as their own).

The function for adding this code is shown below:

[html] function display_copyright_feed( $post_content )
{
if( !$copyright_text = get_option(‘copyright_notices_text’) )
return $post_content;
return $post_content . $copyright_text;
}[/html]

This function simply adds the attribution line to the end of the content and, for all intents and purposes, will work fine. Instead, though, you want to ensure that it only displays when the_content() function (which includes the_content filter) is executed in a feed. You do that by using conditional logic with is_feed(), as shown below:

[html] function display_copyright_feed( $post_content )
{
if( !$copyright_text = get_option(‘copyright_notices_text’) || !is_
feed() )
return $post_content;
return $post_content . $copyright_text;
}[/html]

WordPress has several expected coding conventions. They are enforced throughout the core and are often adopted by plugin and theme authors as well. The sample code shown earlier demonstrates one of those coding conventions by checking if the conditional logic is not true.

Checking for false (as in “this post is not in category 4”) is often easier and cleaner than checking for true. In this case, you performed a conditional check to ensure that the content was not in a feed.

If it is in a feed, you return the content exactly as you got it. However, if it is not in a feed, then you proceed to return the post content with the attribution line appended to the end. Finally, you need to hook this function to a hook like this:

[html] add_filter(‘the_content’,’display_copyright_feed’);[/html]

As with an action, hooking the display_copyright_feed() function to the the_content hook causes it to be fired every time the_content is fired in the Loop, the mechanism used by WordPress to generate and iterate over posts. Because this is a filter, the content_attribution() function expects the post content to be passed to it and it returns modified content back into the Loop.

The Loop is an integral part of WordPress. It is where the magic involving printing blog posts and content into a theme happens. For now, just understand that it is where WordPress processes the requirements for the selection of posts, fetches them from the database and returns the data to WordPress for processing. It is, notably, how WordPress is able to have a number of posts on one page, rendering the blog in expected reverse-chronological order.

The final code block for this section looks like the code shown below: (Using a filter to add a copyright notice to the end of every post.)

[html] function display_copyright_feed( $post_content )
{
if( !$copyright_text = get_option(‘copyright_notices_text’) || !is_
feed() )
return $post_content;
return $post_content . $copyright_text;
}
add_filter(‘the_content’,’display_copyright_feed’);[/html]

The Longevity Blueprint: AI-Powered Health Optimization

Current step:1AI-Human Medical Analyzer: Smarter, Personalized Health
2AI-Human Medical Analyzer: Smarter, Personalized Health

> SYS.HEALTH: AI-Human Medical Analyzer_

// Revolutionize Your Diagnostics

Experience the perfect blend of cutting-edge AI precision and expert human care. Our revolutionary analyzer turns your raw health data into personalized, actionable insights tailored just for you.

> INITIALIZING_BIOMETRIC_SCAN...

[+] DATA_INPUT

Securely upload complex health parameters, including lab bloodwork and comprehensive medical history.

[+] PROCESSING

Advanced algorithmic parsing combined with human-level oversight ensures hyper-accurate data interpretation.

[+] OUTPUT_MATRIX

Receive smarter, faster, and truly personalized care strategies to take immediate charge of your health journey.

A name/nickname is required to continue.

> TRANSLATION_MATRIX_ACTIVE...
[ LANG_EN ]
Knowledge Heals, Prevention Protects
[ LANG_HI ]
ज्ञान ठीक करता है, रोकथाम सुरक्षा करती है
[ LANG_ZH ]
知识治愈,预防保护
[ LANG_JA ]
知識は癒し、予防は守る
[ LANG_HE ]
הידע מרפא, המניעה מגנה
[ LANG_AR ]
المعرفة تُشفي، والوقاية تحمي
[ LANG_FR ]
La connaissance guérit, la prévention protège

> SYS.AUTH: Data Processing Consent_

[ AWAITING_AUTHORIZATION ] By providing consent, you allow us to process your uploaded data through our proprietary AI-Human analysis system.

  • [+] SECURE_REVIEW: This ensures your information is carefully reviewed using advanced AI technology and certified professional oversight to deliver personalized health insights.
  • [+] PRIVACY_LOCK: Your privacy is our strict priority. Your data will only be used for this specific diagnostic purpose.

> SYS.UPLOAD: Share Medical Records [OPTIONAL]_

[ USER_CONTROL_ACTIVE ] Uploading your medical records during registration is entirely optional. You can choose to bypass this step and provide data later if it suits your timeline.

You dictate the data flow: share as much or as little as you’re comfortable with, and let us guide you toward better health.

[+] FORMAT_SUPPORT

We accept all file formats, including photos, PDFs, text documents, and raw official medical data.

[+] DATA_YIELD

Increased inputs correlate with higher precision. The more info you share, the better we tailor your personalized insights.

> NEXT_STEPS: Post-Registration Protocol_

Once your registration is complete, a human specialist from our team will personally reach out to you within 3-10 business days. We will discuss your health journey and map out exactly how we can support you.

About the Author: Bernard Aybout (Virii8)

Avatar Of Bernard Aybout (Virii8)
I am a dedicated technology enthusiast with over 45 years of life experience, passionate about computers, AI, emerging technologies, and their real-world impact. As the founder of my personal blog, MiltonMarketing.com, I explore how AI, health tech, engineering, finance, and other advanced fields leverage innovation—not as a replacement for human expertise, but as a tool to enhance it. My focus is on bridging the gap between cutting-edge technology and practical applications, ensuring ethical, responsible, and transformative use across industries. MiltonMarketing.com is more than just a tech blog—it's a growing platform for expert insights. We welcome qualified writers and industry professionals from IT, AI, healthcare, engineering, HVAC, automotive, finance, and beyond to contribute their knowledge. If you have expertise to share in how AI and technology shape industries while complementing human skills, join us in driving meaningful conversations about the future of innovation. 🚀