Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

In this momment, in search results appear the post but without categories (I think are hidden) and with the links from posts broken. I have a piece of code in this theme that i think is responsible for this. Here is the code:

<?php $post_format = get_post_format() or $post_format = 'default'; ?>

<?php if (get_post_type() != 'post' || is_single() || !Website::getThemeOption("format_post/{$post_format}/content/hide")): ?>
    <div class="content clear"><?php
            if (is_search()) {
                $sq = preg_quote(get_search_query(), '/');
                printf('<p>%s</p>', preg_replace("/\b{$sq}\b/i", '<mark class="search">\0</mark>', get_the_content()));

            } else {
                if (has_excerpt() && !is_singular()) {
                    the_excerpt();
                } else {
                    the_content(Website::getThemeOption('post/readmore'));
                }
                if (is_singular()) {
                    $pages = wp_link_pages(array(
                        'before' => '',
                        'after'  => '',
                        'echo'   => false
                    ));
                    if ($pages) {
                        printf('<div class="pagination">%s</div>', preg_replace('/ ([0-9]+)/', ' <span class="current">\1</span>', $pages));
                    }
                }
            }
        ?></div>
<?php endif; ?>

I want to display in search results the full post untouched, as he is, without any restriction. This code might be the problem or something else? This theme don't have category.php or search.php and this code is from content.php. Is possible to fix this (maybe with a plugin)?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

I'm unaware about the code written within the condition for search page. But the following code instead of your one would have to work:

if (is_search()) {
                the_content();
            }

Try and let me know.

share|improve this answer
    
It works fine ! –  Blanka Oct 7 '13 at 7:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.