0

I have search engine in my site. But when I try to search something, like "loan", the title is not clickable and the other contents are not displaying

How to display the content and the title make as clickable?

SITE HERE

I have this code in search.php

        <?php if ( have_posts() ) : ?>
        <header class="page-header">
            <h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'accesspress_ray' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
        </header><!-- .page-header -->

        <?php /* Start the Loop */ ?>
        <?php while ( have_posts() ) : the_post(); ?>

            <?php get_template_part( 'content', 'summary' ); ?>

        <?php endwhile; ?>

        <?php accesspress_ray_paging_nav(); ?>

    <?php else : ?>

        <?php get_template_part( 'content', 'none' ); ?>

    <?php endif; ?>

Content-summary.php

    <?php
   global $accesspress_ray_options;
   $accesspress_ray_settings = get_option( 'accesspress_ray_options',   $accesspress_ray_options );
   $cat_testimonial = $accesspress_ray_settings['testimonial_cat'];
   $cat_portfolio = $accesspress_ray_settings['portfolio_cat'];

if(!empty($cat_testimonial) && is_category() && is_category($cat_testimonial)): ?>
<article id="post-<?php the_ID(); ?>" class="cat-testimonial-list clearfix">
<div class="cat-testimonial-image clearfix">
<?php 
    if( has_post_thumbnail() ){
        $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'featured-thumbnail', false ); 
    ?>
    <img src="<?php echo $image[0]; ?>" alt="<?php the_title(); ?>">
    <?php }else {?> 
    <img src="<?php echo get_template_directory_uri(); ?>/images/testimonial-fallback.png" alt="<?php the_title(); ?>">
    <?php }?>
</div>

<header class="entry-header">
<h3><?php the_title(); ?></h3>
</header><!-- .entry-header -->
<div class="cat-testimonial-excerpt">
        <?php the_content(); ?>
</div>
</article>

<?php elseif(!empty($cat_portfolio) && is_category() && is_category($cat_portfolio)): ?>
<article id="post-<?php the_ID(); ?>" class="cat-portfolio-list">
<?php 
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'portfolio-  thumbnail', false ); 
 $full_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'large', false ); 
?>
<a href="<?php the_permalink(); ?>" >
<div class="cat-portfolio-image">
    <img src="<?php echo $image[0]; ?>" alt="<?php the_title(); ?>">
</div>
<div class="portofolio-layout">
    <div class="portofolio-content-wrap">
        <h1><?php the_title(); ?></h1>
        <div class="cat-portfolio-excerpt">
            <?php echo accesspress_ray_excerpt(get_the_content(),'100'); ?>
        </div>
    </div>
</div>
</a>
</article>

<?php else: ?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
    <h2><?php the_title(); ?></h2>

    <?php if ( 'post' == get_post_type() ) : ?>
    <div class="entry-meta">
        <?php accesspress_ray_posted_on(); ?>
    </div><!-- .entry-meta -->
    <?php endif; ?>
 </header><!-- .entry-header -->

 <?php if ( is_search() ) : // Only display Excerpts for Search ?>
 <div class="entry-summary">
    <?php the_excerpt(); ?>
    <a href="<?php echo get_permalink(); ?>"> Read More...</a>
 </div><!-- .entry-summary -->
 <?php else : ?>
 <div class="entry-content">
    <?php if(has_post_thumbnail()){?>
    <div class="entry-thumbnail">
        <?php  the_post_thumbnail('featured-thumbnail'); ?>
    </div>
    <?php } ?>
    <div class="entry-exrecpt <?php if(!has_post_thumbnail()){ echo "full-width"; }?>">
    <div class="short-content clearfix">
    <?php echo accesspress_ray_excerpt( get_the_content() , 380 ) ?>
    </div>
    <a href="<?php the_permalink(); ?>" class="bttn"><?php _e('More','accesspress_ray')?></a>
    <?php
        wp_link_pages( array(
            'before' => '<div class="page-links">' . __( 'Pages:', 'accesspress_ray' ),
            'after'  => '</div>',
        ) );
    ?>
    </div>
</div><!-- .entry-content -->
<?php endif; ?>

 <footer class="entry-footer">
    <?php if ( 'post' == get_post_type() ) : // Hide category and tag text for pages on   Search ?>
        <?php
            /* translators: used between list items, there is a space after the comma */
            $categories_list = get_the_category_list( __( ', ', 'accesspress_ray' ) );
            if ( $categories_list && accesspress_ray_categorized_blog() ) :
        ?>
        <span class="cat-links">
            <?php printf( __( 'Posted in %1$s', 'accesspress_ray' ), $categories_list   ); ?>
        </span>
        <?php endif; // End if categories ?>

        <?php
            /* translators: used between list items, there is a space after the comma    */
            $tags_list = get_the_tag_list( '', __( ', ', 'accesspress_ray' ) );
            if ( $tags_list ) :
        ?>
        <span class="tags-links">
            <?php printf( __( 'Tagged %1$s', 'accesspress_ray' ), $tags_list ); ?>
        </span>
        <?php endif; // End if $tags_list ?>
    <?php endif; // End if 'post' == get_post_type() ?>

    <?php //edit_post_link( __( 'Edit', 'accesspress_ray' ), '<span class="edit-link">', '</span>' ); ?>
</footer><!-- .entry-footer -->
</article><!-- #post-## -->
<?php endif; ?>
  • You need to post your content-summary.php. Everything is happening in there – Pieter Goosen Oct 24 '14 at 4:20
  • Post it already @PieterGoosen – User01 Oct 24 '14 at 4:24
0

As for the_title(), you can wrap your title in anchor tag, use get_permalink() to get the path to the single post. Something like this will do

the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' );

For any info on how to modify/style the_excerpt(), check out this post I have recently done. Everything you want to know should be in that post

  • where do i place that? here <h2><?php the_title(); ?></h2> ? @pietergoosen – User01 Oct 24 '14 at 4:38
  • Ok, seems you got it :-). Just for the sake of others, this should replace the_title() where necessary. – Pieter Goosen Oct 24 '14 at 4:57
  • How about to display the title with summary of content? @PieterGoosen – User01 Oct 24 '14 at 6:01
  • Have you read the post I have linked to. Everything is explained in there. Your theme is already using its own excerpt, so you can just replace that if needed with the desired function from my linked post. You can also replace the_content() with the_excerpt() – Pieter Goosen Oct 24 '14 at 6:06

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.