Jump to content


Photo
- - - - -

How to add By [Author] to Metabar

metabar

Best Answer attac , 19 March 2013 - 10:35 AM

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;}
Go to the full post


  • Please log in to reply
6 replies to this topic

#1 attac

attac

    Super Member

  • Members
  • 132 posts
  • Country: Country Flag

Posted 18 March 2013 - 02:50 PM

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?



#2 catrina

catrina

    Advocate

  • Members
  • 12345 posts
  • LocationCalifornia
  • Country: Country Flag

Posted 18 March 2013 - 02:58 PM

Type By [post_author] in the metabar setting field.


  • attac likes this

#3 attac

attac

    Super Member

  • Members
  • 132 posts
  • Country: Country Flag

Posted 18 March 2013 - 03:07 PM

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?


Edited by attac, 18 March 2013 - 03:33 PM.


#4 catrina

catrina

    Advocate

  • Members
  • 12345 posts
  • LocationCalifornia
  • Country: Country Flag

Posted 18 March 2013 - 04:21 PM

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:

Please Login or Register to see this Hidden Content

.



#5 attac

attac

    Super Member

  • Members
  • 132 posts
  • Country: Country Flag

Posted 19 March 2013 - 10:35 AM   Best Answer

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

 

 

Please Login or Register to see this Hidden Content

 

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  

 

 

Please Login or Register to see this Hidden Content

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:

 

Please Login or Register to see this Hidden Content



#6 Danny

Danny

    Is Awesome!

  • Moderators
  • 15120 posts
  • LocationManchester, UK
  • Country: Country Flag

Posted 19 March 2013 - 10:54 AM

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



#7 attac

attac

    Super Member

  • Members
  • 132 posts
  • Country: Country Flag

Posted 02 April 2013 - 10:12 AM

Oops! Don't use 

.author {display:none}

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

 

Use 

Please Login or Register to see this Hidden Content

 

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?







Also tagged with one or more of these keywords: metabar