Here is how to generate bylines like:
Author 1 and Author 2
Author 1, Author 2 and Author 3
You can throw in an Oxford comma too if you want:
Author 1, Author 2, and Author 3
There are several ways you could do this within the plugin logic code, but they would complicate the code and mix up logic and presentation more than it already is in WordPress. This simple CSS solution is the best way to go: http://stackoverflow.com/questions/6587807/comma-delimited-lists-with-css-i-want-an-oxford-comma
Only a few minor changes to the existing plugin code will be necessary:
Nice. I could integrate into a new version of the plugin. Think there is demand for this feature?
I imagine designers would want options such as bars, slashes, etc. …
Well I wanted it, so I forked your plugin for a child theme I’m working on. 🙂 Have you thought about putting the plugin code on GitHub?
This ordered list approach makes it very simple to make it look however you want with CSS. It also suggests a way to swap out the list markup for XML tags like <dc:creator> (RSS2 and RDF) and <author>+<name> (Atom).
What are the chances of making this so the additional authors that you add link to their archived post? Similar to the plugin below. One thing I can’t to work with that plugin is a proper use of commas.
JT – The plugin already works that way. Each name links to their archive page. The plugin code has to be modified to return the names as a list, and then you style the list as a comma separated list. (See my first post.)
Sorry, I meant to say “One thing I can’t get to work with this plugin” referring to the co-author plus.
I am now trying to figure out how to get the byline entries to link co authors archive post.
I saw this from an earlier post:
Flushing rewrite rules does the trick. I will add that to the next update to the plugin. You can force a rewrite-flush by visiting the Settings/Permalink page in your WP admin.
I am not sure how to do it. Any help would be greatly appreciated!
Go to Settings > Permalinks and then save the settings on that page.
Thanks that works now!
Is there a way to populate byline field as you type as there are lot of authors on the blog I maintain. And how would I format the output?
You can edit the bylines just like tags in the posts list or post editor metabox. Like tags if you type “da” it will suggest “Davey Jones” if there is already a Byline with that name.
You can format the output with your CSS. If you need to change the HTML markup that the plugin outputs, you would have to change the plugin code for how it uses WP’s get_the_term_list function. (See the two links in my first post in this thread.)
I added the CSS. Now, what exactly do we change in byline.php, and how do we change it in order to get this?
If I simply change
$author = get_the_term_list( $post->ID, 'byline', '', ', ', '' );to
$author = get_the_term_list( $post->ID, 'byline', '<li>', '</li><li>', '</li>' );, then I get a normal list. How do I introduce the ul class?
If you haven’t edited your page templates yet, you’ll need to do that now to enclose the
For some reason, this isn’t working for me.
Even though it’s supposed to be inline, it kicks the author data to the next line.
There are also commas after all of the entries for some reason. The cite is ignoring all of the “last-child” CSS rules.
Okay, sorry. It obeys the “last child” rules now.
It still knocks down a line, though. It looks like this:
author information | categories
That sounds like it’s just a matter of getting your CSS right. Can you provide a live link so I can take a look?
My site is under a Coming Soon page. I’d be willing to set up a Subscriber account for you so that you can see the page, but if it’s necessary, I guess that I could temporarily remove the Coming Soon page.
- The topic ‘How to display an "and" between the last or only two Byline terms’ is closed to new replies.