Skip Navigation

[Closed] WP RSS Aggregator feed name and post date

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 6 replies, has 2 voices.

Last updated by Nigel 1 year, 3 months ago.

Assisted by: Nigel.

Author
Posts
#2639927

jww

I'm using WP RSS Aggregator to import feed items into a CPT created by Toolset.
I've created a view.
The feed_name and post_published_date don't appear to be custom fields which can be added via the custom fields in the Fields and View or Single Field blocks. They appear as numbers rather than the text of what they are.

If I use their template (but it doesn't have any filtering options) the feed name and published date show up fine.

Do you know how to make them show up correctly with a Toolset view?

Thanks in advance.

#2639929

jww

Also on that same page, I have search filters above the view, one for Feed Categories and one for wprss_item_author.
But on the front end, nothing appears where those search boxes are. That part of the page is totally blank as if they don't exist.

The site isn't live, I can send links in a private reply if you'd like.

#2640169

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I took a quick look at their documentation, I assume you are using the Feed to Post add-on to create posts from imported RSS entries, yes?

Can you give me some sample posts that were imported via RSS feed that I can check how they look in the database.

And can you clarify what you are trying to do? You want to display these posts, and some of the fields you want to output you can't see how to?

Let me add a private reply for the credentials so we have them in this thread.

#2640221

jww

And now the issue is happening on the WP RSS Aggregator page where the search filter blocks say
This block has encountered an error and cannot be previewed.
And none of the settings are available on the right side.
It's the page with the Toolset views displaying the numbers for feed name and author.

#2640667

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2023-09-04 at 14.27.49.png

Phew. That is a lot of updates condensed into a single post, I read through about half but I started to get lost.

I'm going to have to ask you distill where we are and what is needed.

You have the RSS aggregator taking in several RSS feeds and creating aviation-news-item posts automatically.

Looking at one such post there is some limited info in wp_postmeta for that post with custom fields that reference the feed the post came from (screenshot).

Two fields point to the ID of the feed post (a post of custom post type wprss_feed), i.e. wprss_ftp_feed_source, and wprss_feed_id.

Relevanssi support have given you a code snippet that will reference the source feed post of aviation-news-item posts when building the index, so you can search aviation-news-item posts by the feed they were imported from, and this works.

You want a page to output the aviation-news-item posts, and in the output for each news item you want to display which news feed the post came from. That is a relatively straightforward matter, registering a custom shortcode to do something fairly similar to what Relevanssi support gave you, namely to translate the numerical feed ID into its name. I can help with that. Also with formatting the date if that is also an issue.

That's the easy part.

The less easy part is when you want to add filtering to this page (rather than just providing a single text-entry search field, based on Relevanssi's index).

As the ID of the source feed is stored as a custom field of the aviation-news-item posts then you can filter by it.

But your dropdown filter would be a series of numbers (the wprss_feed post IDs, e.g. "56747" rather than "Google News Search: Aviation"), so not very helpful.

I see from what's in wp_postmeta (screenshot) that you have tried unsuccessfully to add a custom field with the source feed name, which could then easily be used to provide a filter. I'm not sure what you did with that, but the easiest solution would be if the RSS aggregator had a hook available after each feed item post is created. You could then hook onto that with a simple snippet that got the feed title from the feed ID and populated the custom field with that value.

Can you see from their documentation (or support) whether such a hook is available (I'd be very surprised it not).

Is my understanding correct? Was there anything else important I missed?

#2642239

jww

Wow you did distill it down perfectly. Sorry it was so much, I kept iterating as I tried to solve it.

Yes the display and search from what it seems like are two different things.

I want to display the name and date (date is still an issue, he says that is Timestamp format), in the news feed summary on page.
I thought that if we could put the name in a custom field to be displayed, then that same custom field could be used for the filtering.

The filtering the way I have it actually works fine from what I can tell. It displays the feed name but the db value is the feed id so...that seems to work and give me the right results. What are you seeing in that set up that is confusing or doesn't make sense? I couldn't see any other way to do it without having feed name tied to id in the db be available.

The Relevanssi search seems to work fine.
The admin columns pro snippet he gave me makes it work for the admin screen which is great.

Small item regarding the filters:
How can I make the view port a bit bigger for the multi-select area?Like to show 15 at a time rather than 5? When I inspect it I don't see how and there isn't anything in the style settings on the right which addresses that option, only margin and padding.

Re Feed name snippet:
I sent what he sent. I just asked again, because it doesn't work - and the feed id in it is not needed - and he said ask Toolset support if you could tweak that snippet to work for Toolset - taking out the feed id bit and adjusting for Toolset generated format. I did try wpcf- but it still didn't work. The idea was to get the feed name into it's own field so it could be used for whatever - styling, filtering etc. Is this snippet something you could tweak for that?

Thanks for hanging in here with me.

#2642759

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I see you started to create a Select custom field "Aviation News Feed Name", which has the feed ID as the value and the feed name as the option label.

Let's work with that. Complete setting up the custom field options.

Once you have done that, try running an update of one or more of the RSS feeds.

I added a Code Snippet on your site with the following code, which will simply copy over the feed ID from the WPRSS field to your Toolset custom field, setting the feed name custom field for every aviation new item post that is created or updated.

So then you should be able to both filter by the feed name using this field, as well as simply display the field name value using this same field.

And you could likely also eliminate the special code that Relevanssi gave you, because you should just be able to include this new Toolset field of yours in the Relevanssi index, and so the feed name will be picked up automatically.

/**
 * When an aviation-news-items post is created or updated
 * set field "Aviation News Feed Name" with ID of RSS feed source
 */
function ts_set_aviation_news_feed_source( $post_id, $post ){
	
	$feed_id = get_post_meta( $post_id, 'wprss_feed_id', true );
	update_post_meta( $post_id, 'wpcf-aviation-news-feed-name', $feed_id );

}

add_action( 'save_post_aviation-news-items', 'ts_set_aviation_news_feed_source', 10, 2 );

Do you want to try that, and if it's all working we can see where we are at and if there is anything missing.

Regarding the date, which date are you referring to? And where do you want to output it? Do you mean the wprss_item_date_field custom field set by the wprss plugin on the aviation news items?

The topic ‘[Closed] WP RSS Aggregator feed name and post date’ is closed to new replies.