Custom feeds action in WordPress blog - wordpress

I want to use WordPress for my blog. I will install it in my local machine. I know that it has RSS feeds with links. But I have 2 confused problems.
When my number of feeds is very big, assume 10.000.000. I want to limit the number of results when load RSS feed with a request's format as:
http://[myblog_domain]/[rss_name]?limit=25
to limit to top 25 results. May be 25,30, 40, ... or any integer for the limit parameter. Are there any way to do that?
Another problem, I want to load a range of RSS items with a request's format as:
http://[myblog_domain]/[rss_name]?from=31&count=10
to load 10 RSS items begining from the 30th one. May be any integer for the 2 parameters: from, count. Are there any way to do that?
Thank you!
UPDATE 1: about limit parameter
I see there's one while loop in the feed_rss2.php file with the format as:
while ( have_posts() ) : the_post();
// Your loop code
endwhile;
It iterate the post. It already has the limit referring to admin's setting section in the web: Setting / Reading / Syndication feeds show the most recent
I guess that I need to modify this iteration to fit my expectation when the url is passed the parameter (limit = 25, assume) .
How can I do it? Thank you!
UPDATE 2: Or Are there any plugins of this purposes?

Yes you can do that in wordpress, read below article first
http://codex.wordpress.org/Customizing_Feeds\
So you can modify the rss output template and dealing with the arguments

Related

How to override the generation of RSS feeds in DSpace?

This is somewhat related to my other question. I was asked to modify the results of the RSS feeds such that the list will be the same as when you view the /browse?type=dateissued in descending order. I can't find where the resulting list of the RSS feeds are generated. Or is this even doable?
I am using DSpace version 5.3 Mirage 2 Theme.
Thanks in advance.
There is recent.submissions.sort-option in dspace.cfg which claims to work for feeds as well:
# the sort option name (from webui.itemlist.sort-option above) to use for
# displaying recent submissions. (this
# is used by the Recent Submissions system and any other time based
# browse query such as FeedServlet)
recent.submissions.sort-option = dateaccessioned
Looks like that's used in XMLUI as well, so you may be able to achieve what you describe by setting this option to dateissued.

WP advanced custom fields Field Group have limit fields?

I created a layout module 7m (layouts). Each layout has about 15-20 fields (including eating and one repeater with fields). There comes a moment when I can not create more fields. And nothing else is stored. A begins to persist if you remove one field. Then another one I can keep.
How can I fix this problem?
Change (screen http://awesomescreenshot.com/08835dz3eb )
But dont work
This is a complete number of fields that can be added (if you add one more), nothing happens. New fields do not appear.
http://awesomescreenshot.com/0f635h2s43
44 filds (all including repeater ) in 7 Layout
I really need to solve this problem. I need at least another 10 fields.
Few solutions you can try..
Increase max_input_vars value from 3000 to 5000 or more.. (it worked for me after increasing value)
This method is if increasing max_input_vars does not help..
Quoted from ACF forum :
“I had the same problem and it turned out that because the server was using the Suhosin patch I also needed to set the following my .htaccess file:
suhosin.post.max_vars = 20000
suhosin.request.max_vars = 20000″
As mentioned by Rahul, 'max_input_vars' and suhosin settings in php.ini are the solution.
But what I would like to add to make this solution complete. You could get into case when migrating to other server or vps, where default setting for "max_input_vars" is 1000 or less and then You try to add new field which will result in all fields that was not in limit to disappear as from AFC administration or from POSTS also! .
So even if you fix the php.ini that leaves you with broken db.
Anyways solution is simple after setting 'max_input_vars' move that ACF field group to Trash, and restore it fields will be back ...
I hope it will save time to someone sometime.
I have the same problem yesterday. I solve this by increasing value of Blog pages show at most and Syndication feeds show the most recent in Setting -> Reading -> Heres the option.
In my WP dashboard, the default is 10.

Wordpress Loop get_the_id()

I tried the following functions in header.php, footer.php, single.php etc.
var_dump(in_the_loop());
var_dump(get_the_id());
The first function gives false (meaning we are not in the loop) and the second function gives the post id every single time.
Description of get_the_id() from wordpress :
Retrieve the numeric ID of the current post. This tag must be within The Loop.
I just want a simple explanation what the hell is going on why do i get the post id if I call the function out of the loop !?
must is a little strong for get_the_id() ...delivers evil eye to Wordpress.
It works in the header and non-loop (confirmed).
Please note that post/page are essentially interchangeable in this conversation.
Think of WP this way -> You always have a post id in some way, all the time, every page, unless you do weird stuff or talk about non-page edge cases. When you are at the install root (such as site.com/) there are posts being called, something has to be displayed. There are other settings that will impact post/page such as static front page settings. On a category listing, if there are pages, I got the first ID returned before the loop.
On post/pages the page ID is (more or less0 set before the loop. This is a result of the URL (pretty or ?p=123 format) dictating the content. Using pretty names, the page at site.com/foo-bar/ will try to look up if there is content available via the permalink rules for "foo-bar". If there is content, the post ID is obtained. (simplified)
Later in the page build you get into the loop. However, before the loop you are also offered opportunities to change, sort, or augment the loop - such as changing the page IDs to be looped or sorting.
Regarding in_the_loop(), WP says
"True if caller is within loop, false if loop hasn't started or has ended." via http://codex.wordpress.org/Function_Reference/in_the_loop
in_the_loop() evaluates if the loop is in action (loop being key to the WP world). Also important - when you are in the loop WP can iterate over multiple page/post (IDs).
I don't have a 100% bulletproof explanation as to how the ID always shows, but when you dig into the API and various methods for hooking this might be a result.
I understand your confusion and agree with you. I think WP intended get_the_id() as a loop based tool, outside the loop you will get unpredictable results.
Hope that helps, I do enjoy working in WP, and I hope you do to.

Yahoo Pipes - Build an RSS-URL using specific parameters pulled from another RSS feed's content

The main Data Type used by Yahoo Pipes is the [Item], which is RSS feed content. I want to take an RSS's content or sub-element, make it into [Text] (or a number might work), and then use it as an INPUT into a [Module] to build a RSS-URL with specific parameters. I will then use the new RSS-URL to pull more content.
Could possibly use the [URL Builder Module] or some work-around.
The key here is using "dynamic" data from an RSS feed (not user input, or a static data), and getting that data into a Data Type that is compatible (and/or accessible) as an INPUT into a module.
It seems like a vital functionality, but I cannot figure it out. I have tried many, many work-around attempts, with no success.
The Specific API and Methods (if you are interested)
Using the LastFM API.
1st Method: user.getWeeklyChartList. Then pick the "from" (start) and "to" (end) Unix timestamps from 1 year-ago-today.
2nd Method: user.getWeeklyAlbumChart using those specific (and "dynamic") timestamps to pull my top albums for that week.
tl;dr. Build an RSS-URL using specific parameters from another RSS feed's content.
I think I may have figured it out. I doubt it is the best way, but it works. The problem was the module I needed to use didn't have and input node. But the Loop module has an input node, so if I embed the URL builder into the Loop module I can then access sub-element content from the 1st feed to use as parameters to build the URL for the 2nd feed! Then I can just scrap all the extra stuff generated by the Loop, by using Truncate.

How to restrict text length of a field while in WordPress editor?

I would like to restrict the fields while creating a new post in WordPress. For the title, it should not exceed 40 characters. For the content, it should not exceed 400 characters. If these maximum values are exceeded, I would like to show an error message and not let the user continue. How do I do that in WordPress?
You should be able to use wordpress filters to modify the code that gets outputted when the editor is called. Essentially you would want to use it to insert some javascript and an extra div tag to display your error, then just read the contents of the "editorcontainer" id and show the error once it reaches a certain character limit.
I don't have the time at the moment to write a case example, but depending on your skill level, the functions you are looking for are:
apply_filters("the_editor", "customfunction_limitarea");
Where customfunction_limit area is your created function to insert the javascript. You can see how the_editor is currently called and how the default filters are applied in "wp-includes\general-template.php" on line 1822. The default looks like this:
$the_editor = apply_filters('the_editor', "<div id='editorcontainer'><textarea rows='$rows'$class cols='40' name='$id' tabindex='$tab_index' id='$id'>%s</textarea></div>\n");
I would try modifying that statement by placing a new filter in a functions.php file located in your themes directory, that way you don't have to worry about it getting over-written during an update. Otherwise, if you absolutely have to edit the wordpress core (generally a no-no), general_template.php would be the place to do it I think.
Essentially just read up on wordpress filters a little bit (be warned there's not a ton of documentation or examples available for it other than the basic stuff), and that should provide everything you need. The input verification end is easy enough to find scripts, just google jquery post limiting. Something like this might be exactly what your looking for:
http://swiki.fromdev.com/2010/02/jquery-maximum-limit-texttextarea-with.html

Resources