Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional [staff-directory] title parameter #19

Open
delitestudio opened this issue Nov 24, 2016 · 6 comments
Open

Optional [staff-directory] title parameter #19

delitestudio opened this issue Nov 24, 2016 · 6 comments

Comments

@delitestudio
Copy link

Hello, in our use case of your great plugin we have the need to insert a title over every table generated by the [staff-directory] shortcode.

For example we need to dynamically implement a layout like this:

title
table1

title
table2

[no title and no table when table is empty]

Is there a way to do this in a clean way? At the moment we have overwritten the class StaffDirectoryShortcode supporting a new title argument but it will be a good idea to have this feature in the official release.

@dmkjr
Copy link

dmkjr commented Nov 25, 2016

staff-directory-shortcode is the page in which you can add something before each loop starts.

@delitestudio
Copy link
Author

@dmkjr I'm not sure to have understood what you mean: as far as I konw staff-directory-shortcode is a shortcode and it's managed in the StaffDirectoryShortcode class. Can you explain me how to add something before each loop starts?

@TurqDevDesign
Copy link
Contributor

@delitestudio Are you trying to add something before each individual staff entry? Or before each group/category of entries? As well, are you wanting to add a specific string, or a string unique to each listing?

If you wanted a unique title for each individual listing, you could go to staff > settings and under Custom Details Fields, at the bottom of the white box, click + Add New Field. Doing so will create a custom field on the add/edit staff pages, corresponding to your new field. Using the shortcode associated with the field (under the Template Shortcode table heading on the settings page) within your list template will print that custom field for each individual.

Does that answer your question, or am I misunderstanding?

@delitestudio
Copy link
Author

delitestudio commented Dec 5, 2016

Hi @TurqDevDesign I'm trying to add something before each group of entries.

I've tried to add something static before [staff_loop] and it obviously works. But what I'm trying to do is to add a dynamic title for each group of entities. Using a shortcode for a field doesn't work because I think they are only be populated between [staff_loop] and [/staff_loop].

Another problem is that this kind of field cannot be bound to single staff entry but it must be unique for each group. This is the reason I've thought it can be a sort of title for each group of entries and well suited to be a parameter for the [staff-directory] shortcode.

As an example, if I have some entries with category student, some with teacher category and no one with admin category, I want to be able to use:

[staff-directory cat="student" cat_field="slug" title="Students:"]
[staff-directory cat="teacher" cat_field="slug" title="Teachers:"]
[staff-directory cat="admin" cat_field="slug" title="Administrators:"]

And have this result:

Students:
Name1 Phone1 Email1
Name2 Phone2 Email2
Name3 Phone3 Email3

Teachers:
Name1 Phone1 Email1
Name2 Phone2 Email2

[No output for admin]

I think we can insert something like this to achieve the behaviour:

Students:
[staff-directory cat="student" cat_field="slug"]
Teachers:
[staff-directory cat="teacher" cat_field="slug"]
Administrators:
[staff-directory cat="admin" cat_field="slug"]

But the output will be:

Students:
Name1 Phone1 Email1
Name2 Phone2 Email2
Name3 Phone3 Email3

Teachers:
Name1 Phone1 Email1
Name2 Phone2 Email2

Administrators:

As you can see there will be a title without any content. The only way to be able to output what we'll expect is to alter the way the plugin outputs the HTML code for each [staff-directory] shortcode.

@timnolte
Copy link
Contributor

It seems to me that more appropriately there would be the option to print the Category. While having a title attribute provides even more flexibility it is completely disconnected from the category chosen. A shortcode attribute that turns on Category printing (with perhaps a Category/Title template for defining the desired output) would be a more automated implementation that would provide more consistency. There could even be a plugin level option that you could globally turn on category titles be output so you wouldn't even have to set it at a shortcode attribute level.

If @adamtootle or @delitestudio have other suggestions I might work this up and submit a PR over the next few weeks. We're actually doing something similar to this (i.e. the manual way) on a site I manage (https://www.daybreak.tv/our-team/) so this would actually simplify a portion for myself as well.

@timnolte
Copy link
Contributor

@adamtootle I can start to work on this however I notice that there has not been any updates to the plugin in the last 7 months and curious about your long term plan is. I'd be happy to take the lead on this plugin if you're open to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants