Skip Navigation

[Resolved] Creating a content template or a page to choose a post to edit from a drop down

This support ticket is created 5 years, 6 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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)

This topic contains 15 replies, has 2 voices.

Last updated by barryG-4 5 years, 6 months ago.

Assisted by: Waqar.

Author
Posts
#1240935
schedule-editor.jpg

Tell us what you are trying to do?
Create a single page for admins to use. On the page I'd like to show a drop down to select a custom post type post to edit. Underneath that when a post is selected, there should be two taxonomies (days of the week) to tick boxes for and save the post data. Underneath that a view will show rows of the days (taxonomies) and to the right of the taxonomy name, the girls already selected to work those days.

In short, a single page to edit and view a weekly schedule.

Is there any documentation that you are following? No but all †he data is in place, just need to know how to create page in Forms (unless that's not the right place to do it). I've read your help articles but the page seems to be looking for a specific post to edit and won't let me choose a post to edit. hidden link

Is there a similar example that we can see? I'm attaching my plan to show you want I mean.

What is the link to your site? hidden link

Many thanks,
Barry.

#1241074

Hi Waqar,

If it would help, I have tried 2 post forms and the log in to the admin is

hidden link
support
support6969/

The site is password protected though. The password is: banana2656

Many thanks,
Barry.

#1241360

Hi Barry,

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

To achieve a single screen for admins similar to the one in your screenshot, you'll need a combination of custom code and Toolset features.

The screen can be divided into 3 main parts:
( screenshot: hidden link )

Part 1:

You'll create a custom select field or drop down, that will include the list of all the items from the Girls post type.
( ref: hidden link )

To dynamically generate the "options", you can create a toolset post View, that outputs the available posts in the Girls post type.
( screenshot: hidden link )

Part 2:

This part consists of the edit form and essentially will work the same way, as suggested in a previous thread:
https://toolset.com/forums/topic/producing-a-list-of-posts-in-a-many-to-many-relationship-field/#post-1230909

Originally, you'll have the separate edit forms for each Girl already available on the page, but initially, all of them can be hidden using either custom CSS or JavaScript code.

When the admin makes a selection in the select field from part 1, the selected Girl's edit form can be made visible, using custom script.
( example: https://stackoverflow.com/questions/18572401/jquery-select-change-show-hide-div-event )

Part 3:

To show the days of the week ( taxonomy terms ) and the attached Girls to each one, you can use two separate views:

a. The parent view will be a taxonomy view, which will cycle through all the days of the weeks.
b. The nested view will be a post view, which will show only those Girls posts, which are attached to the current taxonomy/day of the week.

Here is a detailed guide on the topic of nested views:
https://toolset.com/documentation/user-guides/using-a-child-view-in-a-taxonomy-view-layout/

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

regards,
Waqar

#1241815

Hi Waqar,

Thank you very much indeed for such a detailed reply. I will try to do things one step at time by going through your suggestions.

Many thanks,
Barry.

#1241928

Hi Waqar,

The custom code and javascript parts of the workflow are going to be way beyond my capabilities. I have a work around though.

The client can use a laptop to edit the girls schedule days in the girls post editor menu and for use on a second device, such as a smartphone, I've created a simple text only based page that the admin user can use to view the days (taxonomy) and the girls linked to the days, and have also added [wpv-taxonomy-post-count] as the client specifically asked for it. It looks perfect and I'm very happy but the post count is 1 extra for Mon,Tues and Wed in This Week, and Thur, Fri, Sat, Sun in Next Week. I've removed all girls from any days as a test and checked that there are no girl posts in the bin so where is the count = 1 coming from for those days. Have you any ideas about this please?

Once I can get this to correct itself then I intend to give it to the client and tell him to use it on his phone and then simply edit the girls days in the girls posts on another device. That way he can see the schedule and edit it but by using two devices. Not perfect but it will be fine for now.

The page I created that shows the problem is:

hidden link

Many thanks,
Barry.

#1241930

Just as an example, the view used for the left hand column Monday (This Week taxonomy) is entered in a shortcode module as: [wpv-view name="this-week-monday-girl-count"].

#1242024

Hi Barry,

Thanks for writing back.

The shortcode "wpv-taxonomy-post-count" returns the count of attached posts from all post types and not just a particular one.
https://toolset.com/documentation/user-guides/views-shortcodes/#vf-153470

The taxonomies "This Week Days" and "Next Week Days" are not only attached to the "Girls" post type, but they're also attached to the "Duo Girls" post type. As a result, the count will include the attached posts from both these post types too.

A better and neater way to show a count, in this case, would be creating two post views for the "Girls" post type, for each taxonomy, for example.

1. This Week Days - Girl count
2. Next Week Days - Girl count

As the name indicates, the first one will show the count for this week and the other one for the next week.

To restrict the results for a particular day, you'll include a query filter, to show only those posts which are attached to the taxonomy term, whose slug is passed through a shortcode parameter e.g. "wpvday".
( example screenshot: hidden link )

Note: the correct taxonomy will need to be selected for each view.

Each of these views can just output the count of found items using the "wpv-found-count" shortcode:
https://toolset.com/documentation/user-guides/views-shortcodes/#vf-155378

Once these views are ready, you can call them for each day, just by passing the required day's slug:
( ref: https://toolset.com/documentation/user-guides/passing-arguments-to-views/#controlling-the-filter-with-shortcode-attributes )

e.g.


[wpv-view name="This Week Days - Girl count" wpvday="001-monday"]

[wpv-view name="Next Week Days - Girl count" wpvday="001-monday"]

Note how only one view (for each taxonomy) can be used for each day ( instead of a separate one for each day ).

regards,
Waqar

#1242027

Hi Waqar,

That is completely brilliant. I now understand why the extra count is showing and now you've mentioned it, it should have been obvious to me. Thanks ever so much for the other information on how to do this with just 2 views. Going backwards and forwards in views to edit 14 was stressful. I'll read carefully though your email and I'm sure I'll be able to complete things.

Many thanks,
Barry.

#1242037

Hi Waqar,

just one teeny thing....your suggestions work perfectly, but when I add any text before the shortcode, the query results wrap down to a new line. Is there a way to make the text before (and if needed after) the shortcode, stay on one line? I chose 'unformatted' for the display options in the Loop Wizard.

Here's the text with the shortcode (I've only added it for This Week Monday so far):

MONDAY (this week): No. of girls scheduled: [wpv-view name="this-week-days-girl-count" wpvthisweekday="001-monday"]

And here's the page that displays the results:

hidden link

Many thanks,
Barry.

#1242070

Hi Barry,

Thanks for the update and glad that you liked that suggestion.

To make sure that the view's output remains in a single line, you can enable the check for the "Disable the wrapping DIV around the View".
( screenshot: hidden link )

Note: your website seems to have a cache plugin, so in case you don't see its effect immediately, try clearing all involved caches first.
( screenshot: hidden link )

I hope this helps and you're welcome to open a new ticket for each new question or concern.

regards,
Waqar

#1242177
005-shortcode-on-rota-page.png
004-view-loop-content.png
003-view-loop-editor.png
002-view-loopstyle.png
001-view-top.png

Hi Waqar,

All is perfect. beverlyshills.com is a test site for annabellasescorts.com so I've created what I think is an identical view on annabellas and created a rota page to display it, but it's showing the count of 8 (correct) but displaying it 8 times like you can see here:

hidden link

I've looked very carefully at the view on beverlyshills and the shortcode and I cannot see any difference.

I'm attaching 5 screenshots to show you all the settings.

The only part of doing this that I was confused at, and had to guess, was in the loop editor where I needed to choose fields. I chose Taxonomy This Week Days. I choose that on beverlyshills.com and that works so that's why I chose it on annabellas but it was a guess.

Really, really sorry but are you still able to help or shall I open a new ticket for this?

Many thanks,
Barry.

#1242859

Hi Barry,

The "wpv-found-count" shortcode's output is repeating because it has been placed inside the loop item of the view. Anything in that content template will repeat for each post result found by the view.

You can move that shortcode, outside of the view's loop, by moving it outside the <wpv-loop> ... </wpv-loop> part, as shown in this screenshot:
hidden link

Also, since this view only needs to output the count, you can remove the [wpv-post-body] shortcode too.

regards,
Waqar

#1242886
bh.png
ae.png

Hi Waqar,

I have done that and it works so thank you for explaining it. The code needed to be outside of the loop.

The odd thing is that the exact original code with everything in the loop works on beverlyshills.com. I'm very happy that things are working but it's so confusing to see it working on one of two identical sites and not the other. I'm attaching screenshots but I've taken up way to much of your time already so thank you and I'll just have to learn more about loops and such things.

Many thanks,
Barry.

#1242926

Hi Barry,

Thanks for the update and glad that it is fixed.

The only possible explanation that I can think of, as to why this wasn't caught up on beverlyshills.com website, is that the count of view's results was "1" when you were testing it there.

When the count of returned posts would be 1, the loop's iterations would also be equal to 1, and therefore there won't be any repetitions to note.

Hope this makes sense.

regards,
Waqar

#1242927

Hi Waqar,

Yes of course, that makes sense. What a coincidence. I'm glad you've got a brain.....Mine is sadly worn out. Many thanks indeed.

regards,
Barry.