• Resolved generalsalt

    (@generalsalt)


    For get_categories() and wp_get_all_tags() I am returning an array passing that array to a function that creates columns.

    I really need to keep with the same layout with wp_get_archives(). I want to display archives (per month) in a column format.

    wp_get_archives() doesn’t seem to offer a way to return results as an array. So that is my question, is there a way to make that happen? Many thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • <?php
    $archi = wp_get_archives( 'echo=0' );
    $archi = explode( '</li>' , $archi );
    $links = array();
    foreach( $archi as $link ) {
    	$link = str_replace( array( '<li>' , "\n" , "\t" , "\s" ), '' , $link );
    	if( '' != $link )
    		$links[] = $link;
    	else
    		continue;
    }
    print '<pre>';
    print_r( $links );
    print '</pre>';
    ?>

    Printing at the end is to show you the array, do as you will..

    Thread Starter generalsalt

    (@generalsalt)

    thank you!!

    You’re welcome… 😉

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Return array from wp_get_archives()’ is closed to new replies.