Skip Navigation

[Resolved] Link Results – Re-open Subject

This support ticket is created 7 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 2 voices.

Last updated by John 7 years, 2 months ago.

Assisted by: Luo Yang.

Author
Posts
#485224

I apologize for having to open a new ticket, but your system closed the previous one before I was done and I could not tell whether what I posted would reach anyone.

We were discussing how get the menus to appear and then present results for properties within each state and subsequent drill down on each property.
In the previous thread, Nigel said "

Hi John

I need to know more about how you have set this up in terms of your custom post types, taxonomies etc.

You have a View that lists states which you want to link to an archive of properties for that state, yes?

So the View that lists states. What are the states? A post type? A taxonomy?

And for the property archive. How is the state connected to the property (i.e. how does an Alabama property know it is in Alabama)? Is it assigned as a taxonomy, added as a custom field? Or is there a post relationship set up between a property post type and a state post type?

If you can let me know that then I should be able to work out how to generate the links you require."

Here is the message I tried to post:

Thank you for the detailed response. I believe you understand where I am headed with this.
In using the method you suggested, I began to wonder whether letting the archive filter the results might be a better way. The layout "States Layout" , used on the "Farms By State" page has a cell in it with the following code:

[wpv-layout-start]
	[wpv-items-found]
<div class="state_menu_holder list-group">
<div class="blurb_box12">
   <div class="for_sale_green">Farms For Sale - Select A State</div>
	<!-- wpv-loop-start -->
	<div>
		<wpv-loop>             
<div class="state_holder flex_container">
  <a href="<em><u>hidden link</u></em>">
[types field='state-graphic' size='full' align='none' separator=', '][/types]</a>
<div class="state_title">
  <a href="[wpv-post-url]">
    [types field='state-full-name'][/types]</a>
Farms For Sale</div>
<div class="area_info">
<a>Area Info! <i>[types field='area-information'][/types] </i></a></div>
</div>
		</wpv-loop>
	</div>
	<!-- wpv-loop-end -->
</div>
</div>
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

This layout is used in the "Farms By State" page with no query results.
HOWEVER, clicking on the state title link, such as Alabama, results in seeing the archive for state/alabama with the farms that are children of the Alabama CPT.
So, I am very close to getting this right.
If fact, if the archive page allowed me to drill down into the individual farms as they are listed, I think that would be as far as we needed to go.

Please feel free to suggest a better method if you see one.
Thank you.

#485294

Dear John,

Are we talking about this case:
Custom post type: Farms
custom taxonomy: States

Could you describe more details for the question:
the archive page allowed me to drill down into the individual farms as they are listed

How do you need it to drill down into the individual farms?

If you need a parameter search in the archive page, please follow our document to setup it:
https://toolset.com/2016/12/filter-custom-post-types-taxonomy-custom-fields/#filterable-archive

#486499

You are close. We have custom post type: States and custom post type: Farms.
Farms are children of the states.
The archive page for states list children of the state with this code:

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
	<wpv-loop>
<div class="blurb_box">
  <h1>Click the Farm Name for details</h1>
  [types field='featured-image' size='full' align='right'][/types]
  <p class="farm_name">Farm Name: <a href="[types field='farm-name'][/types]">[types field='farm-name'][/types]</a>
State: [types field='farm-state-select' output='raw'][/types] Status: [types field='status'  option='wpcf-fields-radio-option-261f47e073321dc2e7d6288d56cd5222-1']Active[/types] [types field='status'  option='wpcf-fields-radio-option-d649b1410d80d064ad0e82ad9d069580-1']Sold[/types] [types field='status'  option='wpcf-fields-radio-option-325627426b106233047814be14e92829-1']Under Contract[/types]</p>
<p>County: [types field='county'][/types] Farm Type: [types field='farm-type'][/types]
Acreage: [types field='acreage'][/types]</p>
      
<p>Price [types field='price'][/types]</p>
<p>Description: [types field='general-description'][/types]</p>
<p>Contact: [types field='farm-contact'][/types]</p>
<p>Well Water?: [types field='well-water'][/types] 
Taxes: [types field='taxes'][/types] 
Zoning: [types field='zoning'][/types]</p>
<p>Location: [types field='location-description'][/types]</p>
      </div>      
      <p></p>	
	</wpv-loop>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

This yields a correct list of the farms that belong to a particular state.
I have tried to build a link to a single page that will show the farm's details using the link built with this code. <p class="farm_name">Farm Name: <a href="[types field='farm-name'][/types]">[types field='farm-name'][/types]</a>
When I click the link, I get a "page not found error", so I suspect I need away to tell the link how to process that information.

For example, the home page layout URL of <a href="[wpv-post-url]">
[types field='state-full-name'][/types]</a> yields hidden link
From the list of farms contained within the state of Alabama, the same [wpv-post-url] code yields hidden link. The permalink shows hidden link
Should I use a different shortcode to build the url for the individual farm? When that link is clicked we should be showing the farm using a single page layout.

Any ideas?

Also, if I were to change the states to a taxonomy instead of a custom post type, would this process be any easier or more efficient?
Thank you.

#486532

The permalink of "Farm" posts is defined by wordpress, , when you edit a "Farm" post, you should be able to see the “Permalink”, just below the post title. it should be the link like this:
hidden link

So you will need to modify your codes as below:

<p class="farm_name">Farm Name: <a href="[wpv-post-url]">[types field='farm-name'][/types]</a>

The shortcode [wpv-post-url] will be able to retrieve the post URL of current farm post.

And there isn't such a feature within Types plugin to setup the permalink structure like this:
hidden link.

For the question:
if I were to change the states to a taxonomy instead of a custom post type, would this process be any easier or more efficient?

I don't think it is possible by changing it into a taxonomy too, I suggest you check out our certified partners for it:
https://toolset.com/consultant/

#486866

Thank you. <p class="farm_name">Farm Name: <a href="[wpv-post-url]">[types field='farm-name'][/types]</a>
solved the problem. I can now drill down to the individual farm within the state list.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.