Created
October 30, 2020 20:21
-
-
Save vishalarora91/a2a13e6bb77a32ddf7c16f812784997e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // media_coverages = Post Type | |
| $archives_link = wp_get_archives(array('type' => 'yearly', 'post_type' => 'media_coverages', 'format' => 'option', 'echo' => 0)); | |
| $archives_link = str_replace('</option>', '</option>, ', $archives_link); | |
| $archives_link = preg_replace('#<option.*?>#si', '', $archives_link); | |
| $archives_link = preg_replace('#<\/option>#si', '', $archives_link); | |
| $archives_links = explode(', ', $archives_link); | |
| foreach($archives_links as $link){ | |
| $link = trim($link); | |
| if($link != ''){ | |
| echo '<li><a href="/media_coverages/'.$link.'/">'.$link.'</a></li>'; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment