Help writing a simple plugin
-
I’m teaching myself how to write my own plugins, and I’m making this simple one that prints an url at the end of avery post. Problem is, every post gets replaced by the url, how come? What’s the correct hook to use in order for the url to appear at the end of each post instead of replacing every post? Here’s my code:
<?php /* Plugin Name: Name Plugin URI: https://www.myurl.com Description: My plugin description Version: 1.0 Author: Me Author URI: https://www.myurl.com */ ?> <?php function my_link() { echo "<h2>Some text<h2>"; $my_url = '<a href="https://www.google.com/"</a>'; print $my_url; } add_action ( 'the_content', 'my_link' ); ?>
I’ve tried using both an action and a filter with not much success, can anyone please enlighten me? I know I’m close to getting it. Thanks in advance.
Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
- The topic ‘Help writing a simple plugin’ is closed to new replies.