• Resolved xii

    (@thehiicompanyca)


    Hi there,

    How do I create an archive page that displays specific media/ file types?

    I have created an archive audio template (archive_audio.php) with ‘wp_get_audio-extensions()’ in body of template to display audio formats only, by following instructions here

    However, when I insert ‘wp_get_audio-extensions()’ no posts or media are displayed on (archive_audio.php template) page, only page title. I have also attempted to use ‘wp_get_archives()’ to return audio files only, however default post_type options do not specifically isolate or provide [audio] or wp_get_audio_extensions() option, even if I create a $audio = wp_get_audio_extensions() variable.

    Aiming to display audio, video, and images on their own archive pages.

    • This topic was modified 2 years, 11 months ago by xii.
Viewing 5 replies - 1 through 5 (of 5 total)
  • What’s your WP_Query statement ?

    Thread Starter xii

    (@thehiicompanyca)

    Not sure where that goes…
    I looked at other files that use $WP_Query statement, and I am not too familiar with how to utilize it correctly as I am continuing to expand my understanding.

    Could I share how the code looks on the page?

    • This reply was modified 2 years, 11 months ago by xii.
    Thread Starter xii

    (@thehiicompanyca)

    Edit (not sure if my edit made it up):

    
    <?php 
      $isAudio = new $WP_Query(
        wp_get_audio_extensions()
       ); 
    
     return $isAudio
    ?>
    
    Thread Starter xii

    (@thehiicompanyca)

    This is what wp_query looks like, how do I get $query to display ‘attachment’. Using return, echo, or printf does not display $query variable.

    <?php
    // The Query
    $query = new WP_Query( $args );

    $args = array(
    ‘post_type’ => ‘attachment’,
    ‘post_status’ => ‘published’,
    ‘posts_per_page’ =>25,
    ‘numberposts’ => null,
    );

    if ( $query->have_posts() ) :
    while ( $query->have_posts() ) : $query->the_post();
    // Do Stuff
    echo ($query);
    endwhile;
    endif;

    // Reset Post Data
    wp_reset_postdata();

    ?>

    Thread Starter xii

    (@thehiicompanyca)

    For future researchers,

    in if statement, used php the_content() and the_title() to populate extracted array data for query

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘wp_get_audio-extensions() not working’ is closed to new replies.