Hi I know this is probably an obvious one, but Im just wondering how do I use my own function that I would create in functions.php instead of the default one.
To explain what Ive done, I went into wp-includes/general-templates.php and changed alot of the code around that was in get_calendar.
But upon reading more online I realized that I shouldnt have done this as as soon as the user updates to a new wordpress these lines may be overwritten.
I kept a copy of the original general-templates.php file. So im wondering how do I implement my new updated function instead of the one in general-templates.php?
Thank you
WordPress provides two different means to override default function output: pluggable functions and filters.
Pluggable Functions
A pluggable function (all of which live in
pluggable.php), takes the following form:To override a pluggable function, simply define it in your own Plugin (or in your Theme’s
functions.phpfile, as applicable):Filters
A filter takes the following form:
To override a filter, define a callback and add it to the filter:
Specifically for
get_calendar()If you look in source, you will see that the output for
get_calendar()is passed through theget_calendarfilter:So you would simply write your own callback to modify
$calendar_output, and hook it intoget_calendar.