• Resolved Anas R.

    (@anasr)


    I use this line to generate Archive list:
    <?php wp_get_archives('type=monthly'); ?>
    This line surrounds each link with li opening and ending tags.
    I’d like to generate only links (a tags), without li ones, how can I do that?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello @anas,
    You can do this easily. Take a look at the below scenario:
    If your format is <?php wp_get_archives( 'type=postbypost&limit=100' ); ?>, change it to: <?php wp_get_archives( 'format=custom&before=<p id="test">&after=</p>&type=postbypost&limit=100' ); ?>

    – Now instead of a unordered list using <li></li>, the code will now be inside <p></p>.

    Note: Please see the use of parameter ‘custom’, ‘before’ and ‘after’ here:

    Hope that helps!
    Thanks!

    Thread Starter Anas R.

    (@anasr)

    Thank you, but please set <li></li> as a code, it’s currently hidden in your reply.

    Is your problem solved ? If solved please mark this ticket as resolved. If not please let me know.
    Thanks

    Ok, so to display archives in month order: <?php wp_get_archives( 'format=custom&before=<span>&after=<p>&type=monthly' );?>

    if, you want archives to display archives by post name then do this: <?php wp_get_archives( 'format=custom&before=<span>&after=<p>&type=postbypost' );?>

    Both will show lists without <li>.

    Thanks!

    Thread Starter Anas R.

    (@anasr)

    Yes, it solved the problem, and again, thank you so much.

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

The topic ‘Generating Archive List without `li` Tag’ is closed to new replies.