Jump to content
Audun MB

How to add By [Author] to Metabar

Recommended Posts

Audun MB+    16
Audun MB

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
Audun MB+    16
Audun MB

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 (see edit history)

Share this post


Link to post
Share on other sites
catrina    103
catrina

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.


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
Audun MB+    16
Audun MB

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
Danny    1,327
Danny

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


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
Audun MB+    16
Audun MB

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Similar Content

    • bross51
      By bross51
      I was able to hide the metabar on the single post pages thanks to the included shortcodes however there are no shortcodes to hide the metabar on the remaining pages.  How can this be done?
       
      Thanks for the help.
    • seanocaside21
      By seanocaside21+
      Hi Guys,
      I am using category page to display all posts from a single category. However each post has a child category that separates each post into individual categories, in this case by county.
      Basically i am wondering is it possible to hide the parent category from the meta bar and just show the child?
      Thanks,
      Seán
    • sethoof
      By sethoof
      I am trying to post research paper abstracts for a client and have created a custom post type for doing so using Custom Post Type UI plugin. But I do not know how to customize the pagelines metabar in these posts to remove the date and comment link.  Ideally, I would replace these with some of the custom metadata (paper-author, paper-topic), but if that is not easy to do with custom css, I can just remove the metabar all together and put the info into the post content.
       
      This is the code I want to change as identified by firebug.
      <div class="metabar">
      Posted <time class="date time published updated sc" datetime="2014-04-18T07:30:14+00:00">April 18, 2014</time> · <span class="post-comments sc"> <a href="http://cidrzfoundation.flywheelsites.com/paper/zambian-womens-attitudes-toward-mass-nevirapine-therapy-to-prevent-perinatal-transmission-of-hiv/#comments">Add Comment</a> </span> </div>   Thanks in advance for any help!
    • rijans
      By rijans
      Why author link in metabar points to home site link? It should point to mysite.com/author/alex   ... right? but it is pointing to home page mysite.com . How do I solve this problem?
    • massmosaic
      By massmosaic
      Hi Pagelines staff,
       
      I believe I'm misunderstanding or misusing the "styling classes" field on the front-end editor... 
       
      I'm looking to remove the author username and "add comments" from my forum pages. Here's the url: http://rad.mosaicearth.com/discussions/community/
       
      I've found the correct class via firebug, and tried the following code on the custom frontend code editor, which works:
      .post-meta .metabar {display: none;}
       
      However this removes this metabar across all pages of the site. I would like to keep it in the posts of the site, and only want to remove on the forum pages....
       
      So I went to the "Section Options: Type" and "Section Options: Local" areas of this page and added this code into the styling classes box... but nothing is removed.
       
      Is this the correct use of the "styling classes" field??  If not, what is this area used for?? Also, I assume that "section options: type" will apply changes to that custom post type (bbpress pages) but am not sure.  I checked the Pagelines documentation and don't see any information on the Styling Classes field.  Any advise or references here is much appreciated.
       
      Thank you.
       
       
×