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()) {
                } else {
                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));
<?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)?


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()) {

Try and let me know.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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