I had to choose “individual” as my listing instead of organization. I did this because if I chose “organization” it kept deleting the individual out of the listing.
However, I need these to be alphabetized by the organization, not by the individual.
The page I need help with: [log in to see the link]
You can use the order_by shortcode option to set a custom sorting.
To sort by organization, use this shortcode:
Hope this helps, let me know.
ps. You can choose to create an organization. Then you can add an individual using the “Contact First Name” and “Contact Last Name” fields which are displayed when you choose the Organization entry type.
I have a site for a Business chamber – as is the case with most business associations some members get more involved than others
I have just over 1/2 the members who have sent bio info & photo (while the other half have not)
I’d like to re-order the listings (I’m using cMap) so that the member who have given photo & bio display at the top and then the other underneath them
I looked at the shortcode but couldn’t really see one that would do that
Sorry, but there is not direct way to sort entries by whether or not they have a photo attached to them.
A couple suggestions…
Here’s a link to a tutorial which you could use to sort of create a default image:
If this is too complex, you could add the same image to all entries which do not have a photo. Maybe the chamber logo?
Another alternative is to use one of the fields which can be used with order_by to sort the entries the way you need. For example enter
0in the entries which have a photo attached in the department field and then use order_by to sort by the department field. The negative here is that the
0will be displayed in the entry unless hidden or removed from the template.
My last suggestion is that you could use the Custom Entry Order addon. here’s the link:
Using this addon you could assign all entries with a photo attached an order of
1and then all those entries would list before those that have not been assigned and order. This is probably the cleanest easiest option but does have a small cost which is why I listed it last.
I hope this helps. Please let me know.
I used the “department” method – I put the shortcode in place ion the pageand magically all the ones with images re-shuffled to the top without me editing any of the listings (ie – the Department field is still blank) so that was great!
however there is one listing that is appearing at the very bottom despite having images and starting with the letter A
would you mind taking a look and see if you can work out why
happy to give you Wp Admin access if you let me know where to send it
PS all listings were imported from a CSV
hmmm… if the department field is blank for all, then the sort is likely just by the datetime added or last modified since there is nothing for the database actually to sort by. This would depend on the default database config that your web host setup and not something you could change. This is my best guess.
If the database is sorting by last modified (since the department field is empty), you could try editing the entry and saving it with no changes. That could be enough to bump it to the top. But, if it is sorting by datetime added, there is not a why to bump it to the top without editing the entries to add content to the department field as suggested in my last reply.
Since everything is sorting almost like you want, you can probably get away with just editing the Amarco Holiday House entry and adding 0 to the department field.
You’ll just have to remember or note that somewhere because if the department field is blank you’ll likely get other odd sorting results in time as entries are added, removed and edited, again, because of the blank field and the database having to try to sort based on no content to sort by.
I hope this make sense and is not confusing.
neither of those worked
adding number 0 to Amarco Holiday House listing and then 1 to the next listing resulted in them both going in order – but displaying right at the bottom of the list –
so I think for this to work all listings would need a 1 or 2 in them to specify if its the first group (with pic) or 2nd group (without pic)
I also tried sorting by ‘Biography’ (as those with photo also have bios) but that didn’t work either
I’m just going to leave it alphabetical and if they complain I’ll do the paid for Extention option
thanks again for the fast replies!
It is not possible as you discovered to order_by biography. You can only use the options listed in the docs:
Since the department field is a text field, I guess I was wrong about using
0. I knew it would sort as a string instead of a number, I thought it would still sort naturally to be first. From your description, sounds like it would actually sort to last, after
9. I’d have to test further, again since I forgot, how the database actually handles it.
Oh, the empty departments fields would would sort to the top, unless you change the sort order to be descending instead of the default ascending order.
I hope this helps a little more and Hope your clients like their directory!
- The topic ‘Alphabetizing by organization’ is closed to new replies.