Pergunta

I started to use Wordpress for a project, and using the following plugin Download Monitor

My page listings based on taxonomies all work fine, but im struggling with the search results

My form

<form role="search" method="get" class="right" id="download-form" action="<?php echo home_url( '/' ); ?>">
            <div>
               <input type="text" value="" name="dlm_download" id="dlm_download" placeholder="Search" />
              </div>
        </form>

So when i search and get the results mywebsite.com/?dlm_download=querythe home page gets show.

Than i created after research search-dlm_download.php, still get redirected to home.

Than i found this thread How to create a custom search for custom post type on wordpress exchange that does not work either.

So i am a bit stuck, could someone please point out what i am doing wrong?

EDIT: search-dlm_download.php

<?php get_header(); ?>

    <?php if (have_posts()) : ?>

    <div id="page" class="border-top clearfix">

    <div id="subtitle">

        <h1><?php _e("Search Results for '$s'", 'framework') ?></h1>

        <div id="breadcrumb"><?php the_breadcrumb(); ?></div>

        <div class="hr4"><span class="seperator"></span><span class="lightborder"></span></div>

    </div>

    <div id="content-part">

            <?php while (have_posts()) : the_post(); ?>
            <div class="search-entry post-entry">   

                <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>

                <div class="meta">
                    <?php _e('Posted on', 'framework'); ?> <strong><?php the_time('d.m.Y'); ?></strong> · <?php _e('Posted in', 'framework'); ?> <?php the_category(', ') ?>
                </div>

                <div class="entry">
                    <?php wpe_excerpt('wpe_excerptlength_blog', 'wpe_excerptmore'); ?>
                </div>

                <div class="entry-footer"></div>

            </div>



            <?php endwhile; ?>


            <?php include (TEMPLATEPATH . '/framework/functions/nav.php' ); ?>

    </div>

    <div id="sidebar" class="sidebar-right">
        <?php get_sidebar(); ?>
    </div>

    </div>

    <?php else : ?>

    <div id="page" class="border-top clearfix">

            <div id="subtitle">

                <h1><?php _e('No Results Found', 'framework') ?></h1>

                <div id="breadcrumb"><?php the_breadcrumb(); ?></div>

                <div class="hr4"><span class="seperator"></span><span class="lightborder"></span></div>

            </div>

            <div class="wrap clearfix">

            <div id="content-part">

                    <div class="no-search-result">
                        <p><?php _e("Sorry, no results found. Try different words to describe what you are looking for.", 'framework') ?></p>
                    </div>

            </div>

            <div id="sidebar" class="sidebar-right">
                <?php get_sidebar(); ?>
            </div>

    </div>

    </div>

    <?php endif; ?>



<?php get_footer(); ?>
Foi útil?

Solução

Okay, found a solution by breaking the default search to 2 parts

If anybody needs it in the future you can find it here Create multiple search templates for custom post types

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top