php - What is a better way to implement wp_get_archives modification without touching the wordpress core? -



php - What is a better way to implement wp_get_archives modification without touching the wordpress core? -

i started first ever theme or kind of development in wordpress since yesterday blog, , after getting of basic stuff done, looking create archive page. default output archive page achieved through wp_get_archives function the_title(of post).

however, wanted display archive posts along respective post_date. seems format hard-coded within general_template.php (really!! new wordpress design philosophy farther remark on that)

i did straight modifying general_template.php file in wp-includes directory. changed wp_get_archives & get_archives_link functions (main code changes are...)

*wp_get_archives() ............ $text = strip_tags( apply_filters( 'the_title', $result->post_title, $result->id ) ); $text .= "|||" . date('f j, y', strtotime($result->post_date)); *get_archives_link() ............ elseif ('withdate_ms' == $format) { $text_pieces = explode("|||", $text); $link_html = "\t<li>$before<a href='$url'>{$text_pieces[0]}</a> &bull; {$text_pieces[1]} $after</li>\n"; }

this achieved wanted do. but, not feeling good practice trying straight alter core wordpress files (especially trivial). new wp, guess there must wordpress-way of achieving this, sure. how go implementing modification without touching core? , approach work other changes core functionality (for other set, if need alter in future)?

copy-paste wp_get_archives( ) function theme's functions.php file, rename (to avoid function name conflicts), , utilize function drop-in replacement anywhere utilize wp_get_archives( ).

make sure re-create entire function , other functions used within of function should work fine.

one thing note, if there future updates wp_get_archives( ), you'll have either integrate changes new function, or live without changes, updates have no effect on function.

php wordpress wordpress-theming

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -