Jump to content


Photo
- - - - -

Custom fields in Post Metabar

fields metabar

Best Answer catrina , 07 February 2013 - 06:35 PM

The post metabar only accepts the shortcodes provided by PageLines, but it should be possible to display the content of a custom field somewhere else in the post area. Please see for further info: http://codex.wordpre...g/Custom_Fields

Go to the full post


  • Please log in to reply
8 replies to this topic

#1 Eugenio

Eugenio

    Member

  • Members

  • 10 posts
  • Country: Country Flag

Posted 07 February 2013 - 04:40 PM

Hello, I want to show the content of a custom field in the post metabar. Is it possible?

Is there a shortcut?

 



#2 catrina

catrina

    Advocate

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

Posted 07 February 2013 - 06:35 PM   Best Answer

The post metabar only accepts the shortcodes provided by PageLines, but it should be possible to display the content of a custom field somewhere else in the post area. Please see for further info:

Please Login or Register to see this Hidden Content



#3 Eugenio

Eugenio

    Member

  • Members

  • 10 posts
  • Country: Country Flag

Posted 07 February 2013 - 06:39 PM

OK, thank you Catrina.



#4 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 07 February 2013 - 06:42 PM

You could create your own new shortcode to retrieve the data, then use that in the metabar.

 

Please Login or Register to see this Hidden Content

The wp docs.

 

Please Login or Register to see this Hidden Content

Our shortcodes class, you might get some ideas there.



#5 Eugenio

Eugenio

    Member

  • Members

  • 10 posts
  • Country: Country Flag

Posted 07 February 2013 - 07:00 PM

Thanks Advocate, but is too much for me. I´m creating a calendat of events an only want to show in the blog a list of Image, Title and date (this is in the future). If it´s imposible in the meta, i´ll try how looks in the excerpt. 



#6 johnny_n

johnny_n

    Member

  • Members

  • 26 posts
  • Country: Country Flag

Posted 22 February 2013 - 06:32 PM

This doesn't seem to work.  I'm trying to output a break to split the metabar up into two lines for legibility.

 

Please Login or Register to see this Hidden Content

 

 

The function is simple, (I've tried both with '<br /> and '\n' but that's not the issue:

 

 

Please Login or Register to see this Hidden Content

 

 

What happens is it's not output in the metabar but above it, right after the copy-pad div:

 


Please Login or Register to see this Hidden Content

 

 

I discovered this by outputting a word, instead of the break.  For some reason the underscores are being removed from the function above but they are there.



#7 James B

James B

    Advocate

  • Moderators
  • 5126 posts
  • LocationSurrey - UK
  • Country: Country Flag

Posted 23 February 2013 - 12:46 AM

Hi Johnny 

 

Could you please create a new thread if you need help with this one, as this thread has been marked answered already, any further responses might not be seen by the moderator team.

 

As you're a member of the Pl Developer group you might also be able to check in the skype clan chat to see if anyone knows the answer on the underscores being stripped out. Otherwise drop a new thread and we'll try and check with the core dev's for you.


  • johnny_n likes this

#8 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 23 February 2013 - 10:42 AM

Please Login or Register to see this Hidden Content

 Soory but your doing_it_wrong() ;) Shortcodes should never EVER output anything, the function has to return it back. for example:

function custom_break_func($atts) {
    return "<br />";
}

add_shortcode('custom_break', 'custom_break_func');


  • johnny_n likes this

#9 johnny_n

johnny_n

    Member

  • Members

  • 26 posts
  • Country: Country Flag

Posted 23 February 2013 - 01:51 PM

Fantastic.  Thank you James and Simon - this works beautifully.  Others might find a use for this as well.

 

Appreciate the lesson too, Simon - I had read the Codex shortcodes page a couple of times but your statement is to the point!  :-)







Also tagged with one or more of these keywords: fields, metabar