All Good Things Must Come To An End

As you all know, I have been doing WordPress plugins and supporting it for the past 6 years. These 6 years of my life, I have been through my polytechnic education, my national service as well as my university education.

I just graduated from university in December 2009 and have been looking for full-time jobs. I am offered a full-time job and will be starting work on 1st February 2010.

I regret to say that I am NOT ABLE to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

However, I WILL still update my plugins whenever I can and you still can report bugs to me via email and I will try to fix it.

Author Topic: Need to append a custom field to title in widget...  (Read 1641 times)

0 Members and 1 Guest are viewing this topic.

Offline jschodde

  • Newbie
  • *
  • Posts: 21
    • View Profile
I have a classifieds site and I need to display the item price after the post title in the widget (I did something similar to the WP-Post Views plugin).

I can't figure out which lines of code to edit for this change in wp-email.php. My desired results are like this:

Top 10 Most Emailed Ads
-----------------------------
2008 Arctic Cat Thundercat - $9500
2005 Polaris Trailboss - $2400
etc...

Thanks!

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,692
    • View Profile
  • WordPress Version: WordPress 3.0.x
  • Theme Name: lesterchan.net v3.4
Re: Need to append a custom field to title in widget...
« Reply #1 on: 30 July 2009, 00:52 »
if you did it with wp-postviews.php, it is the same, wp-email.php. You may want to take a look at the function at 758, get_mostemailed()

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline jschodde

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Need to append a custom field to title in widget...
« Reply #2 on: 30 July 2009, 04:06 »
if you did it with wp-postviews.php, it is the same, wp-email.php. You may want to take a look at the function at 758, get_mostemailed()

Forgot to mention that I'm on WP2.8.2 using WP-Email 2.5.

Here's what I did starting at line 1543 in wp-email.php:

foreach ($mostemailed as $post) {
   // JAS 7/29/09 - Added next two lines to display price with post title.
   $ad_currency = get_option('currency');
   $ad_price = $ad_currency.get_post_meta($post->ID, "price", true);
   
   // JAS 7/29/09 - Original Code
   //$post_title = get_the_title();
   
   // JAS 7/29/09 - New Code...
   $post_title = get_the_title().' - '.$ad_price;


Do you see anything wrong with this?

Thanks,
Jeff

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,692
    • View Profile
  • WordPress Version: WordPress 3.0.x
  • Theme Name: lesterchan.net v3.4
Re: Need to append a custom field to title in widget...
« Reply #3 on: 30 July 2009, 04:15 »
Nope I don't see anything wrong with that. You may want to do a var_dump($post->ID) to see if it does return the ID. if no you can try get_the_id();

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline jschodde

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Need to append a custom field to title in widget...
« Reply #4 on: 30 July 2009, 05:09 »
Thanks Lester! You are THE man. :D