Skip Navigation

[Resolved] Link post-title in view1 to single post in view2

This support ticket is created 6 years, 4 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 6 replies, has 2 voices.

Last updated by charlotteM-2 6 years, 4 months ago.

Assisted by: Nigel.

Author
Posts
#920979

Tell us what you are trying to do?
I have two views: view1 contains the 'archive' of CPT-blogs; view2 contains the single CPT post. (I don't want to work with the standard 'Template' for the single post because I need to put it in a WordPress page in order to be able to customize my sidebars.

Is there any documentation that you are following?
I serached in documentation and in the forum, but can't find anything.

Is there a similar example that we can see?
The page in which view 1 is hidden link
The page I'm trying to link to is hidden link

What is the link to your site?
hidden link

#921196

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Charlotte

Before trying an unorthodox way of displaying archives and single posts, let me cover the alternatives:

1. using a recommended theme. I don't see any debug info for your site so I can't see which theme you are using. The themes on our recommended theme page support theme options in templates, so if you create a template for single "project" posts, for example, and your theme has options for full-width, sidebar left, sidebar right etc., you can set those per template.

2. if you are not using such a theme then the recommended way would be to create a copy of single.php which you rename for your post type (e.g. single-project.php) and edit that template to, for example, remove where the sidebar is inserted if applicable. That way you are still using the standard WordPress Template Hierarchy, maintaining the expected URLs.

If neither of those are possible, then, yes, you can create a View to list posts and rather than linking to the single post you link to a static page that will be used to display the single posts and pass the ID of the target post as a URL parameter. You then add a View to the static page which "listens" for the URL parameter to know which post to display.

That is described here: https://toolset.com/documentation/user-guides/passing-arguments-to-views/

#921205

Hi Nigel, thank you for the reply.
Still one question.
I have as Theme OceanWP, which is recommended. But in the template it only gives the option to enable or disable the sidebar. So, I think, I will choose your number 2. solution.
Do you still recommend that solution with OceanWP?

Have a nice day!
Charlotte

#921228

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Yes, option 2 is still viable.

What settings is it that you wanted to make for sidebars on the template that you cannot?

I can pass that information on if it seems like we should make more options available (though that would take time to implement if it were the case).

#921335

Hi Nigel,
What I want is to be able to choose two sidebars in a custom post type template and that is not an option at this moment (like it is on a regular page).

Thanks so far, I'm going to try to make a new single.php page. The name you suggest: single-project.php; should that 'project' be the slug of the template?
Can I find help on this topic?

Ciaou,
Charlotte

#921336

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

project is the slug of the post type, so the single-project.php template file would be used to render all single project posts.

See https://developer.wordpress.org/themes/basics/template-hierarchy/

#922327

I'm going to try and resolve.
Thanks!