Skip Navigation

[Resolved] News Site layout

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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 3 replies, has 3 voices.

Last updated by Christian Cox 6 years, 4 months ago.

Assisted by: Christian Cox.

Author
Posts
#1117187

Tell us what you are trying to do?
I would like a module based option for a new design of a news site.

Here is the design:
hidden link

Moduls could be like:
"1 news story"-modul, "2 news stories"-modul, "1 ad"-modul, "1 hero"-modul etc.

Then the modules could make up a page and be placed in the sidebars just like a view.

But important is that news stories could step to the next story when used and not just a static parameter set on the view.
So fx. the module "1 news story" should have a counting variable when used...

Hard to explain hope that this makes sense 🙂

The old layout is live here:
hidden link

#1117257

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jesper,

Thank you for contacting our support forum.

Not sure what exactly you want me to do here ? You want to create a module to list some content ?

Please let me know.

Thanks,
Shane

#1118156

Hi
Yes, list post content.

My idea is to have a 'view' and make it into what I call a 'module'.
The difference is at the module can count!

1.
Count the number of post used by the module and saved the value so that that other modules (or itself) can used it.

2.
Exclude posts that are used by other views on that page so that duble post is avoided.

3.
The counting should honor post stickiness

#1119117

Hi, preventing post duplicates across multiple Views on a site is not an easy task. It can be done, but most of what you're asking for will require advanced custom code beyond the scope of support we provide here. I can assist with any code that touches the Toolset APIs, but the majority of the code is your responsibility. If you're not a skilled PHP developer, you will probably need assistance from one. We have a portal available where you can connect with independent contractors: https://toolset.com/contractors

Here are some more details about each requirement, and how it can be accomplished:
1. Count the number of post used by the module and saved the value so that that other modules (or itself) can used it.
This is currently possible in PHP using the get_view_query_results API. This API allows you to access the results of any View query using PHP. Then you can build a list of post IDs from those results, count the number of results found, and check the result limits applied in each View. This will require some PHP experience. We have documentation for this API available here: https://toolset.com/documentation/programmer-reference/views-api/#get_view_query_results

2. Exclude posts that are used by other views on that page so that duble post is avoided.
You must add a post ID Query Filter to each View that excludes specific posts by ID, then use the get_view_query_results API (link above) to get the results of all previous views and apply those IDs to each subsequent View's post ID filter using PHP. This will require some advanced PHP knowledge. Again, I can assist with any code that touches a Toolset API, but the majority of this code is your responsibility.

3. The counting should honor post stickinessYou can use the wpv_filter_query API or the wpv_filter_query_post_process API to manipulate filter queries:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query_post_process

I'm not completely clear what this means and I need more details to give you more detailed advice.