• Resolved Dharator

    (@dharator)


    Hello, i’ve tried to use the wp_get_archives that comes with this plugin (cptda_get_archives), but can’t seem to make it work… this is what i tried:

    <select name="archive-dropdown" onchange="document.location.href=this.options[this.selectedIndex].value;">
      <option value=""><?php echo esc_attr( __( 'Select Month' ) ); ?></option> 
      <?php cptda_get_archives( array( 'post_type' => 'my-post-type', 'type' => 'monthly', 'format' => 'option', 'show_post_count' => 1 ) ); ?>
    </select>

    Yet it displays nothing…

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Dharator

    (@dharator)

    Ok… apparently i can’t use it the same way as wp_get_archives with the options in an array, had to use it like this:

    <select name="archive-dropdown" onchange="document.location.href=this.options[this.selectedIndex].value;">
      <option value=""><?php echo esc_attr( __( 'Select Month' ) ); ?></option> 
      <?php cptda_get_archives( 'post_type=my-post-type&type=monthly&format=option&show_post_count=1' );; ?>
    </select>

    The documentation isn’t very clear about this and this kind of example is not listed in the codex for wp_get_archives, you should consider updating you documentation and maybe add some examples, the code that worked for me is the one in this response in case anyone else has the same problem as i did.

    Everything else work great btw, leaving a good review.

    • This reply was modified 7 years, 6 months ago by Dharator.
    • This reply was modified 7 years, 6 months ago by Dharator.
    Plugin Author keesiemeijer

    (@keesiemeijer)

    Hi Dharator

    Thanks for the review ??

    It should both work with an array or string. Maybe you discovered a bug. I will let you know if I find anything regarding your issue.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp_get_archives problem…’ is closed to new replies.