page plus category and tags and search + picture

Hello mr Aigars,

[1] Posts have always at the bottom the category and if available, the tags.
Is it possible to place this line also on pages ?
I use already a plugin to notice wich tags are important.

[2] If a post/page has a featured image, is it possible to display this picture in the search display ?
Just like for instance along the category listing. (extension on category editor)

Regards.

  1. There are no categories and tags available for pages in WordPress therefor they are not available for this theme as well. It is possible to implement them using a plugin such as this one. However, you will still have to modify theme template files because there is no output for categories and tags built in by default.

  2. To add featured image inside search results you should edit file called content-extensions.php and on that file you should find function called:

travelify_theloop_for_search

Now on that function find

<header class="entry-header">

And add this code on top of it:

<?php
if( has_post_thumbnail() ) {
$image = '';
	$title_attribute = apply_filters( 'the_title', get_the_title( $post->ID ) );
	$image .= '<figure class="post-featured-image">';
	$image .= '<a href="' . get_permalink() . '" title="'.the_title( '', '', false ).'">';
	$image .= get_the_post_thumbnail( $post->ID, 'featured', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).'</a>';
	$image .= '</figure>';

	echo $image;
}
?>

Now search results will look like archive pages and default blog pages.

Let me know if this is what you were looking for.

Hello mr Aigars,

[1] Indeed,that particular plugin I’m using.
But I have to correct myself, no need to display because the cat/tag data is saved by that plugin and another plugin ‘search everything’ find this data so it is displayed in the search overview.

[2] it’s just marvelous what you have made, thank you very much! Even the picture has an url to go to the specific page.

The only problem - always with mod’s on a theme - is to remember after an update. The change has after the php comment slashes the url of this page and my initials to find a change :wink:

  1. These changes can be made via Child Theme to make changes update safe.

You can do that by following these simple steps:

  1. Download a sample Child Theme form here.
  2. Add default search look in functions.php file that looks like this:
if ( ! function_exists( 'travelify_theloop_for_search' ) ) :
/**
 * Function to show the search results.
 */
function travelify_theloop_for_search() {
	global $post;
	if( have_posts() ) {
		while( have_posts() ) {
			the_post();
			do_action( 'travelify_before_post' );
?>
	<section id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
		<article>

			<?php do_action( 'travelify_before_post_header' ); ?>

			<header class="entry-header">
    			<h2 class="entry-title">
    				<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute();?>"><?php the_title(); ?></a>
    			</h2><!-- .entry-title -->
  		</header>

  		<?php do_action( 'travelify_after_post_header' ); ?>

  			<?php do_action( 'travelify_before_post_content' ); ?>

  			<div class="entry-content clearfix">
    			<?php the_excerpt(); ?>
  			</div>

  			<?php do_action( 'travelify_after_post_content' ); ?>

		</article>
	</section>
<?php
			do_action( 'travelify_after_post' );
		}
	}
	else {
		?>
		<h1 class="entry-title"><?php _e( 'No Posts Found.', 'travelify' ); ?></h1>
      <?php
   }
}
endif; 
  1. Now make changes in this code that I described in the previou thread.

This will make sure that you won’t need to do these changes again once you update this theme.

Let me know if this is what you were looking for.