Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Saved Meta Values Don't Display On Front End Page WordPress

  • SOLVED

Hi,

I'm running into some problems getting the saved values in the database to be correctly displayed on the page, in fact the information does not want to show at all.

Some modifications have been done to the WP RSS Aggregator plugin.

http://wordpress.org/plugins/wp-rss-aggregator/

Namely this plugin file has been modified: includes/admin-metaboxes.php
Modified file code: http://pastie.org/private/k1svduhrqvdg0sbret7mw


And I'm using this code to loop the feed entries:

http://pastie.org/private/uomc1kiyqz67x479lvsa

For some reason the image that I upload when I create a new feed source is not displaying, and the Feed Source Title is also not displaying.

Feed Image meta key: wprss_uploadvalue
Source Title meta key: wprss_sourcetitle


When I search for these values in the database after saving I see they are saved in the database, but for some reason the code doesn't want to output the values.


What is required to make the values display correctly?

Thanks in advance for your help!

Answers (6)

2013-06-24

Thierry Pigot answers:

Hello,

Where do you want to display the image ?

If it's in the feed list, you have to also edit the function <strong>wprss_display_feed_items</strong> in <strong>wp-rss-aggregator.php</strong> file


Edwin comments:

Hi Thierry, thank you for the suggestion and looking into this. All needed edits are now completed though.

2013-06-24

Dbranes answers:

It looks like you are fetching the meta value for a wrong post ID,

The <em>get_the_ID()</em> you are using are for post types <em>wprss_feed_item</em>
but the <em>wprss_uploadvalue</em> meta value is saved for post types <em>wprss_feed</em>.

ps: <em>query_posts </em> is "old school", you should consider the <em>WP_Query()</em> or the <em>pre_get_posts() </em> hook instead.


Dbranes comments:

You could use this code inside your loop:

$feed_id = get_post_meta( get_the_ID(), 'wprss_feed_id', true );

echo "wprss_uploadvalue = " . get_post_meta( $feed_id, 'wprss_uploadvalue', true );


to get the <em>wprss_uploadvalue </em>meta value.


Edwin comments:

Thank you!- this was very helpful!

2013-06-24

Giri answers:

Let me explain something.. Your rss aggregator has two post types.

wprss_feed

wprss_feed_item


Rss feed items are stored in "wprss_feed_item" post type.. But your uploaded images, title are stored in "wprss_feed" post type..

So here is my modified code.

[[LINK href="https://gist.github.com/mistergiri/4b3cecad6602b78e805b"]]https://gist.github.com/mistergiri/4b3cecad6602b78e805b[[/LINK]]

I'm using the post id manually in my code. Which means you should go to

rss aggregator -> All feed sources -> edit -> copy the post id from url -> change the post id in my code

Change line 29 and 31 with that post id

https://gist.github.com/mistergiri/4b3cecad6602b78e805b#file-feed-php-L29
https://gist.github.com/mistergiri/4b3cecad6602b78e805b#file-feed-php-L31


Giri comments:

I updated my code. Change the post id only in line 29


Edwin comments:

Thanks Giri for your provided input, it's very much appreciated.

2013-06-24

Arnav Joy answers:

can you share your db?

also have you checked without doing modification in plugin file did you getting output?

2013-06-24

Remy answers:

Did you try to display all the custom fields values to see what is returned ? Using get_post_custom() for example : [[LINK href="http://codex.wordpress.org/Function_Reference/get_post_custom"]]http://codex.wordpress.org/Function_Reference/get_post_custom[[/LINK]]


Edwin comments:

I've tried various debug plugins, oddly enough, the expected meta values did not show.

The needed edits to get everything to work as needed are completed now by another developer.

2013-06-24

isp_charlie answers:

just check "get_the_ID()" value make sure it not empty