Navigation überspringen

[Gelöst] Design pages with dynamic content

This support ticket is created vor 4 Jahren, 7 Monaten. 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/Karachi (GMT+05:00)

Dieses Thema enthält 14 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von Waqar vor 4 Jahren, 7 Monaten.

Assistiert von: Waqar.

Author
Artikel
#1653737
Screenshot 2020-06-08 13.04.36.png

Tell us what you are trying to do? I have already created custom post and their templates and then I realised that these can't be displayed as home pages and that I have to create a NEW PAGE to actually use a home page.. so I tried to create one.. here is my content template...
versteckter Link
and here is my home page
versteckter Link
I am completely lost with home pages.. as there's no real relationship that the page has with the content.. so when I had to show the cover of the magazine on the left I had to create a new view with a condition very specific to the issue (screenshot attached) and then I had to do the same for the editorspeak.. for the articles I had nothing to connect as articles are connected to issues so I can't create a view for article that's very specific to the article.. so I tried to query a relationship and it seemed to work (as in the ADD block I got the right fields displayed) but I still get NO ITEMS on the home page in the front end..

Would I have to have very specific queries for each block? Or could I have a universal query for the whole page so that when I have to update the ISSUE, I don't have to update each an every block?

Is there any documentation that you are following? https://toolset.com/documentation/getting-started-with-toolset/

Is there a similar example that we can see?

What is the link to your site? versteckter Link

#1653811

Hi,

Thank you for contacting us and I'd be happy to assist.

Whenever there is a need to show a post or a list of posts based on set criteria, on any page including the homepage, you can create a post view.

For example, suppose that your website includes a post type "Products". To show selective products on the homepage based on different criteria, you can use multiple post views.

- To show the most recent products, you can create a post view for products and set it to show a selected number of products, ordered by the published date.

- To show the products based on different gender or age group, you can add a new custom taxonomy for example "Product For" and add terms like "Men", "Women", "Kids" etc and attach the correct term to each product.

This way you'll be able to show posts on the homepage filtered by taxonomy filter based on these terms.

- Similarly, if you just need to show specific products on the homepage which doesn't fulfill any specific taxonomy/category criteria, you can add a new checkbox type custom field "Show on Homepage" to your products post type.

This will allow you to enable this checkbox for the target product posts and then show only those products through a post view with a custom field query filter.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1653871

Hi Waqar

Thanks for the update..:-)..

I know it sounds weird that I have created templates and why would I find it difficult to create pages?..;-).. but I seem to be stuck..

you already have access to my site as I had passed on the credentials to you.. can you please check in ParfumPlus MAgazine subsite (it's a multisite installation).. what am I doing wrong? and how do I make Articles visible?

I've tried all possibilities but I seem to be getting 'No items to display' message for all three views.. 'cover image', 'editorspeak' and 'articles view'

Regards,
Alim

#1654857

Hi Waqar

Any update on this?... please do advise... In the ParfumPlus Magazine subsite there are only 3 or 4 pages.. the one you need to check is called Home Page :: ParfumPlus

In case of any queries please do let me know.

Have a nice day..:-)..

Regards,
Alim

#1655289

Hi Alim,

Thank you for waiting, while I looked into the views added on the page "Home Page :: ParfumPlus".

There are different reasons why all 3 views on the page were not showing any results:

1. View: Current Issue Cover:

In this view's query filter settings, the comparison type was set to date, when in the back-end the values for the date type custom fields are saved in Unix timestamp format.

Changing date to number fixes the query filter and the issue "Vol 8 Issue 2" is showing now.
( screenshot: versteckter Link )

You can read more about query filters involving dates, from this guide:
https://toolset.com/documentation/user-guides/views/filtering-views-query-by-date/

2. View: Current Editorspeak:

That view is set to show "EditorSpeaks" type posts but in the query filter settings, the "Publishing Date" custom field is used which is not attached to this post type.

If you'd like to also use this field for filtering this post type, please make sure that this field is attached to this post type.

3. View: Current Articles:

That view is set to show the "Articles" post type, with a post-relationship filter for the "Issues Articles" relationship.

The option "The post where this View is shown" won't work here because this view is being used on a page and not on a single "Issues" post page.
( screenshot: versteckter Link )

In this case, you'll have to use the "Specific" option to tell which Issue post's related articles should be shown here.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1656525

Thanks Waqar... I am much clearer now about the difference in PAGES and CONTENT TEMPLATES, thanks to you..:-)..

However I have one query.. as you may have noticed that on my home page I have 3 sections (cover, editorspeak and articles) which all are related to the current issue (vol-8 and issue-2) but yet I have to manually set this criteria for each section.

Is this the only way to do it ? Or can I do something where I define the volume and issue in one section and the other sections pick up the relationship? Maybe it's not possible but I'd like to know for sure so that I don't struggle on this part..

Basically my requirement is that for the next issue I would have to update all 3 sections.. do I have to do it the way it's done now or can I change one section and the others automatically get updated?

Please do advise. If it's not possible, please do let me know so that I can mark this ticket as resolved.

Regards,
Alim

#1657173

Hi Alim,

Thanks for the update and glad that my messages helped.

To make these 3 sections more dynamic and easier to manage, you can follow these steps:

1. From your actual page "ParfumPlus : Vol 8 Issue 2", delete the existing view blocks for these 3 sections:
- Current Issue Cover
- Current Issue Editorspeak
- Current Issue Articles

You can also delete these views from WP Admin -> Toolset -> Views.

2. Create 3 separate pages, which will hold one view for each of these sections:

a) Current Issue Cover
On this page, you'll create a new view to show the Issue posts, similar to the one you've created earlier to show the current issue's cover.

The only difference would be that in the "Query Filter" section you'll include a post ID filter, linked to "ids" shortcode attribute.
( example screenshot: versteckter Link )

b) Current Issue Editorspeak
On this page, you'll create a new view to show the Editorspeak post, similar to the one you've created earlier, to show the related issue's Editorspeak.

In this view's "Query Filter" section you'll include a post-relationship filter, linked to "issueeditorspeak" shortcode attribute, for the "Issues Editorspeak" relationship.
( example screenshot: versteckter Link )

c) Current Issue Articles
On this page, you'll create a new view to show the Article posts, similar to the one you've created earlier, to show the related issue's Articles.

In this view's "Query Filter" section you'll include a post-relationship filter, linked to "issuearticle" shortcode attribute, for the "Issues Articles" relationship.
( example screenshot: versteckter Link )

Once these views are ready, you can include them in your actual page "ParfumPlus : Vol 8 Issue 2", through the "wpv-view" shortcode in a "Fields and Text" block, like this:
( ref: https://toolset.com/documentation/user-guides/views/views-shortcodes/#wpv-view )


[wpv-view name="Current Issue Cover" ids="123"]

[wpv-view name="Current Issue Editorspeak" issueeditorspeak="123"]

[wpv-view name="Current Issue Articles" issuearticle="123"]

Note: You'll replace 123, with the ID of actual target Issue post.

This, way you'll be able to reuse these views on separate pages for each issue, by just replacing the ID in the "wpv-view" shortcode.

regards,
Waqar

#1657977
Screenshot 2020-06-11 16.14.35.png

Hi Waqar

I did as you mentioned and according to me it's all good and I've even doube - checked all the details and compared them to your instructions.. it all seems good but for some reason I can't seem to see the content that I am trying to call using shortcodes..:-(..

The screenshot is attached..

I even cleared the server cache etc but still no luck..

I assumed the double quotes in the short code could be an issue and made those into single quotes just to check.. even that didn't work.. I've tried almost everything I could think of..

can you please log in and check what i could be doing wrong, please?

Regards,
Alim

#1659411

Hi Waqar

A gentle reminder for this ticket.. please do let me know if you were able to figure it out.. I would appreciate if you could help me fix this today itself as I'd like to push this to the home page today itself.

Don't mean to pressurize you.. just that as it's the weekend coming up I don't want it to go to next week if I can finish it today.

Have a nice day..:-)..

Regards,
Alim

#1659553

Hi Alim,

Thanks for writing back and sorry about the delay in getting back on this.

I'll be looking into the changes made on your website and will update you with my findings shortly.

Thank you for your patience.

regards,
Waqar

#1659563

Hi Waqar

It's working!!!..;-)...

But I have a few quick questions here to understand properly what was happening..

I had the PAGE name as 'Current Issue Editorspeak' and the view/block name as 'Current Editorspeak'... and the shortcode as
[wpv-view name="Current Issue Editorspeak" issueeditorspeak="123"]

It didn't work..

So I assumed that maybe the shortcode should have the view/block name and not the PAGE name so I changed it to this..

[wpv-view name="Current Editorspeak" issueeditorspeak="123"]

It didn't work

Then I changed the view/block name to Current Issue Editorspeak .. basically the same name as the PAGE and used the original short code

[wpv-view name="Current Issue Editorspeak" issueeditorspeak="123"]

and it worked!!

Please advise what name should go in the shortcode.. the PAGE or the VIEW/BLOCK? and does the PAGE name or the VIEW/BLOCK name have to be the same?

Please advise and I will close this ticket immediately..:-)..

Regards,
Alim

#1659571
Screenshot 2020-06-12 14.23.22.png
Screenshot 2020-06-12 14.23.14.png

If you are working on the site.. could you please test if you are able to make the Home Page that we were working on as the site's home page? I just did this and published but the home page seems to be a showing but with each page 'Current Issue' Current Editorspeak and Current Articles before it shows the real home page where they are all combined.. screenshot attached..

#1659613

Hi Alim,

As explained in the documentation ( ref: https://toolset.com/documentation/user-guides/views/views-shortcodes/#wpv-view ), the "wpv-view" shortcode expects the view's name or slug. The page's title should have no part in this.

If you can reproduce this issue on a test page where this shortcode doesn't work unless the view and the page have the same name, please let me know.

As for the homepage, I've selected your website's page named "Home" as a Homepage in the reading settings ( WP Admin -> Settings -> Reading ) and it is showing the content correctly.
( screenshot: versteckter Link )

regards,
Waqar

#1659633

My issue is resolved now. Thank you!

Thanks Waqar for confirming that it's the view's name that's important and not the PAGE name.. I would be struggling a lot without that information as I always assumed it was the page name..;-).. didn't realise the page was there only to hold the view..

but if that's the case then If I were to create one page with all the views and create 3 shortcodes on another page with the different views, would it work? If yes, Why do I then need to 3 pages? I know I am closing this ticket..;-).. but if possible please do respond to this query.

Also I didn't realise that the home page could be set in SETTINGS->READING.. I always used APPEARANCE->CUSTOMIZE->HOME PAGE SETTINGS.. anyways every day we learn something new..;-)..

Have a nice day...:-)..

Regards,
Alim

#1659665

Hi Alim,

Creating 3 separate holding pages 1 for each view is not necessary and you could have created these 3 views on 1 single holding page too.

But I used 3 separate pages to make it easier to explain and make view's management clutter-free.

regards,
Waqar