This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Hook the get_the_excerpt filter hook, run the function named mfp_Add_Text_To_Excerpt | |
add_filter("get_the_excerpt", "mfp_Add_Text_To_Excerpt"); | |
// If today is a Thursday, remove the filter from the_excerpt() | |
if (date("l") === "Thursday") { | |
remove_filter("get_the_excerpt", "mfp_Add_Text_To_Excerpt"); | |
} | |
// Take the excerpt, add some text before it, and return the new excerpt | |
function mfp_Add_Text_To_Excerpt($old_Excerpt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: My First Plugin | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: My First Plugin | |
Description: This is my first plugin! It makes a new admin menu link! | |
Author: Your Name | |
*/ | |
// Include mfp-functions.php, use require_once to stop the script if mfp-functions.php is not found | |
require_once plugin_dir_path(__FILE__) . 'includes/mfp-functions.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Add my new menu to the Admin Control Panel | |
*/ | |
// Add a new top level menu link to the ACP | |
function mfp_Add_My_Admin_Link() | |
{ | |
// My code goes here | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Add my new menu to the Admin Control Panel | |
*/ | |
// Add a new top level menu link to the ACP | |
function mfp_Add_My_Admin_Link() | |
{ | |
add_menu_page( | |
'My First Page', // Title of the page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Add my new menu to the Admin Control Panel | |
*/ | |
// Hook the 'admin_menu' action hook, run the function named 'mfp_Add_My_Admin_Link()' | |
add_action( 'admin_menu', 'mfp_Add_My_Admin_Link' ); | |
// Add a new top level menu link to the ACP | |
function mfp_Add_My_Admin_Link() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="wrap"> | |
<h1>Hello!</h1> | |
<p>This is my plugin's first page</p> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Hook the 'the_content' filter hook (content of any post), run the function named 'mfp_Fix_Text_Spacing' | |
add_filter("the_content", "mfp_Fix_Text_Spacing"); | |
// Automatically correct double spaces from any post | |
function mfp_Fix_Text_Spacing($the_Post) | |
{ | |
$the_New_Post = str_replace(" ", " ", $the_Post); | |
return $the_New_Post; | |
} |