Archived

This topic is now archived and is closed to further replies.

  • 0

How to add By [Author] to Metabar


Question

Posted · Report post

I'd like the meta-information to not only display the authors name, but say "By author".

 

(I'm talking about the metainformation you add with [post_author] on the Blog And Posts page.)

 

How to do that? Is there something one can include in the short code?

Share this post


Link to post
Share on other sites

6 answers to this question

Posted · Report post

Catrina: thanks for your advice, but I am already using custom CSS. But that doesn't solve my problem of adding "By Author" only to some posts. Since you can't add span (with classes or ID) directly to the metabar, CSS can't do that. 

 

But I managed to find the solution myself, and it is elegantly done by Pagelines. They just forgot to tell us about it.

 

Looking into the code I realized that I can actually add information to the shortcode like this

 

 

[post_author_posts_link before=By ] 

 

to do what I want. This is documented anywhere else than in the code unfortunelately. Please do!

 

For reference for others looking for help:

The shortcodes in the metabar accept the following parameters, before, after and sep. Sep indicates what separator to use between tags and categories. Default is ", " but you can change it to anything you like. I use  

 

 

[post_categories sep= |]  

Before and after puts the text before and after the shortcode. Most of the shortcodes for the metabar seems to accept before and after. By experimentation I found that you are better off using non-breakingspace than just a space, as spaces may be removed by Wordpress.

 

For dates and time I guess you can edit the format by using somthing like format= with PHP-date string if you want something else than the default format, but this isn't explained in the code. There's also a label code, but I don't know what it does.

 

Pagelines add classes to the shortcodes, so you can target the different pieces of the metabar to make them look differently, and hide them on some pages. I use the following code to only show author in one category archive:

 

.author {display:none}
.category-331 .author {display:inline;}

Share this post


Link to post
Share on other sites

Posted · Report post

Oops! Don't use 

.author {display:none}

that will hide author pages completly as the page class for author-pages also is author.

 

Use 

.metabar-pad .author {display:none}

 

instead.

 

BTW to developers: using the same class for different things seems wrong. The ones used in the metabar should probably have a different name?

Share this post


Link to post
Share on other sites

Posted · Report post

Thanks for sharing, I've noted this on my to-do-list for documentation.

Share this post


Link to post
Share on other sites

Posted · Report post

Type By [post_author] in the metabar setting field.

1 person likes this

Share this post


Link to post
Share on other sites

Posted · Report post

That obvious.  :D thanks.

 

But can I add a span to that text? I'm using CSS to hide post author on most pages, so if I'd like to hide the "By" text as well.

 

Edit:

 

No, I can't. Is there another way to target that text?

Share this post


Link to post
Share on other sites

Posted · Report post

Yes there is a way to target the text. You’ll need to use Custom CSS (in PageLines > Site Options > Custom Code > Custom CSS/LESS). To find the Custom CSS you need, you'll need to use Firebug (or Chrome Development tools). To learn how to use Firebug for CSS customizations, please review this entire documentation and follow the instructions: http://support.pagelines.me/docs/customization/custom-css.

Share this post


Link to post
Share on other sites