Jump to content


Photo
- - - - -

metabar filter


  • Please log in to reply
7 replies to this topic

#1 glevine

glevine

    Member

  • Members
  • PipPip
  • 12 posts

Posted 19 April 2011 - 07:19 PM

I recently saw a reply by Adam Munns that showed the following solution to modifying the way meta data is displayed in the metabar using the Base functions.php file...

Please Login or Register to see this Hidden Content


Expanding on this, I'd like to only modify the way the metabar is displayed when in "clips" format. The function in PlatformPro's library.templates.php file is the following:

Please Login or Register to see this Hidden Content


How can I make sure the "format" parameter is passed correctly to the filter I've added in my Base functions.php file?

Thanks!

#2 cmunns

cmunns

    Advocate

  • Members

  • 6537 posts
  • Country: Country Flag

Posted 19 April 2011 - 08:06 PM

Use the same conditionals as in the original function e.g. ` if( $format == 'clip'){ $metabar .= sprintf( '%s [post_date] ', __('On','pagelines') ); } `

#3 glevine

glevine

    Member

  • Members
  • PipPip
  • 12 posts

Posted 20 April 2011 - 03:36 PM

Hmmm... I did that, but it doesn't come out the way I want it. Here's what I added to the Base functions.php file.

Please Login or Register to see this Hidden Content


The output I'm getting on the homepage (magazine format) is On March 19, 2011 ?· Leave a Comment ?· In News. If the format is "clip", then it should be just On March 19, 2011. So I'm not sure why the format isn't being recognized correctly. Maybe you have an idea of where I'm going wrong?

#4 cmunns

cmunns

    Advocate

  • Members

  • 6537 posts
  • Country: Country Flag

Posted 20 April 2011 - 06:57 PM

Hmm maybe it won't work because the $format variable isn't reachable outside of the function. Let me know see if I can more info.

#5 glevine

glevine

    Member

  • Members
  • PipPip
  • 12 posts

Posted 25 April 2011 - 08:13 PM

Thanks for looking into this, Adam. Any luck finding a solution?

#6 cmunns

cmunns

    Advocate

  • Members

  • 6537 posts
  • Country: Country Flag

Posted 26 April 2011 - 10:52 PM

Andrew is going to add to the filter for v 1.4

#7 matt85

matt85

    Member

  • Members

  • 17 posts
  • Country: Country Flag

Posted 13 June 2011 - 07:45 PM

Hi, any progess on this? I think the problem is that the add_filter command in wordpress does not allow to pass variables to substituted functions. Take a look at the parent theme: the function pagelines_post_metabar is called in template.postloop.php (line 142) and 'clip' is passed to the function. You can't pass this by sustituting with the add_filter command. The following works for me: Copy the pagelines_post_metabar function to your functions.php in your base theme and rename the function (dont' forget the printf -line at the end!). Don't do the add_filter('pagelines_post_metabar', 'your_function') thing, you won't need it with this approach. Then copy the library.templates.php to your child-theme folder, too. In the copied library.templates.php go to line 142 and change the pagelines_post_metabar('clip'); to your_renamed_function('clip'); That should do. Drawback: when updating the theme you have to manually update the library.templates.php and reapply the changes. If you don't want to mess up in library.templates.php another solution would be using conditional tags (

Please Login or Register to see this Hidden Content

) like is_home instead of if( $format == 'clip'). With that you should take Adam Munns approach of course.

#8 catrina

catrina

    Advocate

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

Posted 14 June 2011 - 02:30 AM

If you want, you can also wait for the update that will include the filter.