WordPress.org

Ready to get started?Download WordPress

Forums

Attitude
[resolved] Broken search results? (8 posts)

  1. tiamaureenjohnson
    Member
    Posted 7 months ago #

    URL: http://www.libertarianresources.com/

    After adding the plugin Revelanssi, my search results broke... at last that is what the plugin author told me.

    "You need to edit your search results template. It's broken, as it's missing post titles and links to the posts.

    <h3><a>"><?php the_title(); ?></a></h3>

    adds the title and

    <a>">Read more...</a>

    adds a link to the post, when added to your search results template."

    The problem manifest by not linking search results to their source or apply the "Read more...".

    I attempted to add these tags to the search.php template to no avail. Is there some opening or closing tags I need to add? Is it common to add html to php templates?

  2. C W
    Member
    Posted 7 months ago #

    In fact, the titles are there, they're just hidden by CSS:

    .page .entry-title { display: none; }

    See here. I don't know how that CSS file is being controlled, but the highlighted rule is the reason why you see no titles.

    Is it common to add html to php templates?

    Yes. It is ultimately impossible not to. The point of the PHP template files is to generate HTML content on the server side that is then served to readers.

  3. tiamaureenjohnson
    Member
    Posted 7 months ago #

    Thanks. Still, I am at a loss as to why the problem persist after I add the aforementioned html to the search results template. Search results are not links to the content source, and the "read more..." are also not showing up in search results. Is it tags I am missing, or am I not posting the html in the proper place? Here is where I placed the code:

    <?php
    /**
     * Displays the search results of the theme.
     *
     * @package Theme Horse
     * @subpackage Attitude
     * @since Attitude 1.0
     */
    ?>
    
    <?php get_header(); ?>
    
    <?php
    	/**
    	 * attitude_before_main_container hook
    	 */
    	do_action( 'attitude_before_main_container' );
    ?>
    
    <div id="container">
    	<?php
    		/**
    		 * attitude_main_container hook
    		 *
    		 * HOOKED_FUNCTION_NAME PRIORITY
    		 *
    		 * attitude_content 10
    		 */
    		do_action( 'attitude_main_container' );
    	?>
    </div><!-- #container -->
    
    <?php
    	/**
    	 * attitude_after_main_container hook
    	 */
    	do_action( 'attitude_after_main_container' );
    ?>
    
    <?php get_footer(); ?>
    
    <h3><a>"><?php the_title(); ?></a></h3>
    
    <a>">Read more...</a>

    This is where it was recommended I put the html. Not working though. Ideas?

  4. C W
    Member
    Posted 7 months ago #

    Because in this theme, search.php does not directly control the formatting of search results. The search functionality is hooked in from elsewhere.

    But the solution to your problem with search results lacking linked titles doesn't require you to dig around the PHP templates. As I already said in my first reply, you need to remove or override this line in your CSS:

    .page .entry-title { display: none; }

    The HTML markup on your search page is already correct. If you added anything to search.php (and it looks like you have), then you should probably remove it.

  5. C W
    Member
    Posted 7 months ago #

    On a more general note, given that the theme developer appears to offer free support for this theme on its website, I would have thought it best to go there when you need help, since the people who create and maintain the theme are clearly in the best position to provide support.

  6. tiamaureenjohnson
    Member
    Posted 7 months ago #

    Thanks for your time and responses. Unfortunately removing CSS didn't resolve the problems. I will ask author of Revelanssi for help or choose a different plugin.

    In fact, the titles are there, they're just hidden by CSS:
    .page .entry-title { display: none; }

    Maybe it is just me, but saying it is "hidden by CSS" doesn't imply to me that I need to remove that line of CSS. But then again, I am just a code noob.

    Nevertheless, I really appreciate the help. Thank you!

  7. C W
    Member
    Posted 7 months ago #

    Maybe it is just me, but saying it is "hidden by CSS" doesn't imply to me that I need to remove that line of CSS.

    When an HTML element is styled with a display: none declaration, the element is hidden from view. Hence, you need to remove or override such a declaration in order to make that element visible again.

    To learn more about the display property, see the MDN reference page. To learn more about how CSS works, see the MDN guide.

    This is, to belabour the point, the singular reason at the moment why you are not seeing linked titles on your search results. See, as an illustration, this screenshot of what your page looks like when I disable the display: none declaration. As you can see, the effect of removing the declaration is to make the heading appear for each search result, which is linked to the article in question.

  8. tiamaureenjohnson
    Member
    Posted 7 months ago #

    That clarifies a lot. Thanks a ton for your help, really appreciate it the time.

Reply

You must log in to post.

About this Theme

About this Topic