3 column layout for Search results page

Hey,
I added a search bar in custom header for my blog page. When you search for something they all come up 1 image, full width. I want it to be a layout like my blog, 3 posts across. How can I give this page the same layout: http://2e6.274.myftpupload.com/?s=rustic

Thanks for your help,
Rena

Hi Rena,

Thanks for reaching out.

Do you have existing customization related to _index.php? If yes, then you can change this like

if ( is_home() ) :

to this

if ( is_home() || is_search() ) :

Else, please follow this (included steps for FTP in case you’re still not familiar with them :slight_smile: )

  1. You have two option, using your hosting’s file manager (usually Cpanel) or use FTP client. Example, you can use FileZilla client (not server), then you can check the documentation of that software here https://wiki.filezilla-project.org/Documentation (FileZilla Client).

  2. Let’s say you’re prefer FTP client, then log-in to your FTP client with your FTP host name, username, password, and PORT (FTP or SFTP).

  3. Then navigate to your remote site’s folder where the template is located (template that you wish to copy). Example,

/home/****/public_html/wp-content/themes/x/framework/views/global/

  1. Now, download the _index.php to your local folder and edit it through text editor like NOTEPAD, or any code editor. And change this line

if ( is_home() ) :

to this

if ( is_home() || is_search() ) :

Then save it.

  1. Then upload that file from your local folder to your remote site’s folder, but this time, navigate to your child theme’s folder (the same path as above but for child theme)

/home/****/public_html/wp-content/themes/x-child/framework/views/global/

And that’s it :slight_smile:

And if you decide to use your hosting’s file manager then you can check their documentation. The process is similar, you’ll just need to copy the file from the same path of parent theme to the child theme path then edit it there.

Thanks!

Ok I tried this, im pretty familiar with filezilla, i had to create a global folder in the child theme and then i placed it in there. But nothing happened.

This is the top part of what I have:

$stack = x_get_stack();

if ( is_home() || is_search() ) :
$style = x_get_option( ‘x_blog_style’ );
$cols = x_get_option( ‘x_blog_masonry_columns’ );
$condition = is_home() && $style == ‘masonry’;
elseif ( is_archive() ) :
$style = x_get_option( ‘x_archive_style’ );
$cols = x_get_option( ‘x_archive_masonry_columns’ );
$condition = is_archive() && $style == ‘masonry’;
elseif ( is_search() ) :
$condition = false;
endif;

?>

Is this correct?

Hi Rena,

Sorry, forgot the line that should be changed too, please change this

$condition = is_home() && $style == 'masonry';

to this

$condition = ( is_home() || is_search() ) && $style == 'masonry';

And optionally, please remove this since this has no use anymore.

elseif ( is_search() ) :
$condition = false;

Thanks!

THAT DID IT! I should have seen that! I was trying deleting the elseif part but missed the top one.

Thanks!

Glad to hear everything is working fine now.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.