WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Different sizes of Feeds (2 posts)

  1. Bernhard Riedl
    Member
    Posted 6 years ago #

    hi folks!

    i like travelling and thus geo-tagged all my posts. - now it want to work this information a bit more. - i already implemented the gps-data in my feeds. the feeds (tags, date, ...) together with google maps give a nice overview of where i've been.

    anyway, only the last 10 posts are displayed within an feed, what's good, because my friends actually like to stay up-to-date. nevertheless, this is not an appropriate way to get all geo data into google maps. hence, i tried to make the feed length variable by adding these lines into /wp-includes/feed-rss2.php.

    <?php do_action('rss2_head'); ?>
    
    /* begin edit */
    <?php if (isset($_GET['all'])) { query_posts($query_string.'&posts_per_page=-1'); } ?>
    /* end edit*/
    
    <?php while( have_posts()) : the_post(); ?>

    what i don't understand is, why the $query_string variable is not processed, because if &all= is set in the url, all posts are displayed, even i select to display only the posts of one tag in the feed.

    anybody got an idea what i'm doing wrong?

    cheers berny

  2. Bernhard Riedl
    Member
    Posted 6 years ago #

    hmm, after hours of trial-and-error with several wp hooks and query_posts, i worked out a quick and dirty solution for my problem. - the changes in wp-includes/query.php do the following: if a get variable 'getall' is set, the size of the feed will not be defined by the post_per_rss variable; instead i just set post_per_page in the query to be 100.

    if ( $this->is_feed ) {
    	if (!isset($_GET['getall']))
    		$q['posts_per_page'] = get_option('posts_per_rss');
    	else
    		$q['posts_per_page'] = 100;
    
    	$q['nopaging'] = false;
    }

    to avoid having search engines indexed the long feeds, i appended a redirect in my .htaccess and an entry in my robots file.

    does anyone have a better idea? maybe the usage of some action hook will do that in a much more nicer way. - i really appreciate any suggestions...

    berny

Topic Closed

This topic has been closed to new replies.

About this Topic