• Resolved tiamaureenjohnson

    (@tiamaureenjohnson)


    URL: https://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?

Viewing 7 replies - 1 through 7 (of 7 total)
  • C W (VYSO)

    (@cyril-washbrook)

    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.

    Thread Starter tiamaureenjohnson

    (@tiamaureenjohnson)

    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?

    C W (VYSO)

    (@cyril-washbrook)

    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.

    C W (VYSO)

    (@cyril-washbrook)

    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.

    Thread Starter tiamaureenjohnson

    (@tiamaureenjohnson)

    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!

    C W (VYSO)

    (@cyril-washbrook)

    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.

    Thread Starter tiamaureenjohnson

    (@tiamaureenjohnson)

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Broken search results?’ is closed to new replies.