We would like to display a block of 4 similar posts at the bottom of a post.
That are:
- Same field: Location
- Same field: Type of space
- The 4 posts that are the closest number to field: sq. ft.
How do we achieve that?
hidden link
See bottom of page for image example
We started by copying the content template from this page - hidden link
Updated the view name
Removed the search bar
but the search bar is still showing (button of the page) - hidden link
Hello. Thank you for contacting the Toolset support.
When you duplicate template - did you try to create another view, as your purpose to display the related posts based on some field conditions.
Can you please share admin access details and tell me what template you duplicated once I review your current settings I'll be able to guide you in the right direction.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
On this page I can see one view with search form on left and search result on right and at bottom of the page.
Do you mean you want to remove the search form and only display the related property based on the current post field location value, type of space value and closes number of sq. ft.?
Yes, that is what I mean. How can we achieve that?
I copied the content template so that I didn't need to recreate all the same styling.
This is the copy - hidden link
When I removed the side bar in the template, it was still showing in the page. Even though I changed the view name and CT name. Not sure why that happens?
I see the following content template is assigned to post type "space" to display single space posts:
=> hidden link
I've disabled the search for the view at top but still when I check on the frontend it shows another view with search at bottom:
=> hidden link
Are you building the site with Toolset only or have you defined view anywhere else?
In addition to that, to filter the view with current post values, you will have to build the view in classic mode as we will require to pass the current post values as view's shortcode attribute.
As its not possible to filter the block view using the shortcode attribute, we have to create the view in classic mode.
I've created the following view in classic mode:
=> hidden link
Where:
- As you can see I've added the Query filters for taxonomy locations and spacetypes as well as sq. ft. custom field.
Taxonomy filter:
Select posts with taxonomy:
Locations slug in one of those set by the View shortcode attribute wpvlocation
eg. [wpv-view name="view-name" wpvlocation="xxxx"]
AND
Space types slug in one of those set by the View shortcode attribute wpvspacetype
eg. [wpv-view name="view-name" wpvspacetype="xxxx"]
Custom field filter:
Select items with field:
Sq. Ft. is a number between 0, VIEW_PARAM(sqvalue)
Then, to the content template you created I've added the above view as given under:
=> hidden link
It should list the posts if it found any matches where:
- taxonomy location is same as current post
- taxonomy space type is same as current post
- custom field sq. ft. value between 0 to the value of current post of sq. ft. custom field
(we do not have any artificial intelligence to apply to determine what would be the closest value)
as you can check with the following post:
=> hidden link
It shows "no items found" under the "Similar spaces":
You can add whatever content you want to display with the single space content template:
=> hidden link
As the we can not get the closest value of the sq.ft I have removed this filter. The similar spaces are now showing as a List - hidden link
If I want to style this like they are in the image example similar space, is this done in the VIEW? - hidden link
Also I wanted to check what happened to this page -hidden link
The main search and results seem to have disappeared
You can see how this should be on the live site - hidden link
I want to make sure when I recreate this on the live site, that I do not loose the main search and results page - hidden link
You can build the view's template using blocks, click on button "Edit with block editor" and you can format your view output as desired.
=> hidden link
To do that, you should first click on "Loop Wizard" button and select your output and then add any field for now and then you can use the feature "Edit with block editor".
Also I wanted to check what happened to this page -hidden link
The main search and results seem to have disappeared
==>
You should try to add your view as in my testing I must have removed the view that you added to find your lab page.