• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Custom Feed Page Eleven40

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Custom Feed Page Eleven40

This topic is: resolved

Tagged: custom page, Eleven40-Pro, parse RSS

  • This topic has 2 replies, 1 voice, and was last updated 11 years, 8 months ago by winnydejong.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • August 28, 2013 at 10:53 am #59242
    winnydejong
    Member

    Hi,

    I'd like to build a 'Link Page', where the latest of my RSS feed on Pinboards shows. I've come up with this, but it isn't quite working. The title doesn't show; I can't figure out how to add pagination; and the sidebar and breadcrumbs are showing up underneath the links... (Guess I forget to close something... but what?)

    Hopefully you can help. Thanks in advance!

    Best, Winny

    <?php
    /* 
    Template Name: Pinboards Links
    */
    
    // FORCE LAYOUT
    add_filter ( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' );
    remove_action( 'genesis_loop', 'genesis_do_loop' );
    
    //Add my latest links to page
    include_once(ABSPATH.WPINC.'/rss.php'); // path to include script
    $feed = fetch_rss('http://feeds.pinboard.in/rss/u:winnydejong/t:ddj/'); // specify feed url
    $items = array_slice($feed->items, 0, 30); // specify first and last item
    ?>
    
    <?php if (!empty($items)) : ?>
    <?php foreach ($items as $item) : ?>
    
    &lt;h3&gt;<a>&quot;&gt;&lt;?php echo $item['title']; ?&gt;</a>&lt;/h3&gt;
    &lt;p&gt;&lt;?php echo $item['description']; ?&gt;&lt;/p&gt;
    
    &lt;?php endforeach; ?&gt;
    &lt;?php endif; ?&gt;
    
    &lt;?php genesis(); ?&gt;
    August 28, 2013 at 11:49 am #59255
    winnydejong
    Member

    Worked some of it out by my own. Though the title of the page and the entry paragraph are still showing up under the footer... Any ideas? Help is very much welcomed! 🙂

    &lt;?php
    /* 
    Template Name: Pinboard
    */
    get_header(); ?&gt;
    &lt;div id=&quot;content&quot; class=&quot;content&quot;&gt;
    &lt;?php
    // FORCE FULL WIDTH LAYOUT
    //add_filter ( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' );
    //remove_action( 'genesis_loop', 'genesis_do_loop' );
    
    //Add my latest links to page
    include_once(ABSPATH.WPINC.'/rss.php'); // path to include script
    $feed = fetch_rss('http://feeds.pinboard.in/rss/u:winnydejong/t:ddj/'); // specify feed url
    $items = array_slice($feed-&gt;items, 0, 20); // specify first and last item
    ?&gt;
    
    &lt;?php if (!empty($items)) : ?&gt;
    &lt;?php foreach ($items as $item) : ?&gt;
    
    &lt;h3&gt;<a href="&quot;&lt;?php">&quot;&gt;&lt;?php echo $item['title']; ?&gt;</a>&lt;/h3&gt;
    &lt;p&gt;&lt;?php echo $item['description']; ?&gt;&lt;/p&gt;
    
    &lt;?php endforeach; ?&gt;
    &lt;?php endif; ?&gt;
    &lt;/div&gt;&lt;!-- #content --&gt;
    
    &lt;?php get_sidebar(); ?&gt;
    &lt;?php get_footer(); ?&gt;
    
    &lt;?php genesis(); ?&gt;
    August 28, 2013 at 4:26 pm #59336
    winnydejong
    Member

    With a little help I categorised all rss items by date; made a bullet list of the feed; added basic pagination; and fixed the title (shows up correctly).

    My solution:

    &lt;?php
    
    /*
    Template Name: links
    */
    
    	// Filter toevoegen aan the_content()
    	add_filter('the_content', 'winny_rss_content');
    	
    	function winny_rss_content ($content) {
    		//Add my latest links to page
    		include_once(ABSPATH.WPINC.'/rss.php'); // path to include script
    		
    		$feed  = fetch_rss('http://feeds.pinboard.in/rss/u:winnydejong/t:ddj/?count=400'); // specify feed url
    		$items = array_slice($feed-&gt;items, 0, 999); // specify first and last item
    		
    		if (!empty($items)) {
    			// Per pagina
    			$perpage = 20;
    			$page		 = (int) $_REQUEST['pagina'];
    			$pages	 = ceil(count($items) / $perpage);
    			
    			if ($page &lt; 0 || $page &gt;= $pages) {
    				// Automatisch eerste pagina als pagina nummer niet bestaat
    				$page = 0;
    			}
    			
    			// Selectie maken
    			$items = array_slice($items, $perpage * $page, $perpage);
    			
    			// $date definieren, maar geen inhoud
    			$date = '';
    		
    			foreach ($items as $item) {
    				// Datum filteren
    				$item['date'] = date('j-n-Y', strtotime($item['dc']['date']));
    				
    				if ($date != $item['date']) {
    					if ($date) {
    						// Vorige lijst afsluiten
    						$content .= '</ul>';
    					}
    				
    					// Nieuwe datum
    					$date = $item['date'];
    					
    					// Nieuwe lijst begonnen
    					$content .= '&lt;h5&gt;' . $item['date'] . '&lt;/h5&gt;';	
    					$content .= '<ul>';
    				}
    				
    				// Link aan lijst toevoegen
    				$content .= '<li>&lt;h5&gt;<a>' . htmlentities($item['title'], ENT_QUOTES, 'UTF-8') . '</a>&lt;/h5&gt;';
    				$content .= '&lt;p&gt;' . htmlentities($item['description'], ENT_QUOTES, 'UTF-8') . '&lt;/p&gt;</li>';
    			}
    			
    			// Laatste lijst sluiten
    			$content .= '</ul>';
    			
    			if ($pages &gt; 1) {
    				// Meer dan 1 pagina
    				$content .= '&lt;p&gt;Pagina: ';
    				
    				for ($i = 0; $i &lt; $pages; $i ++) {
    					if ($i == $page) {
    						$content .= '<strong>' . ($i + 1) . '</strong>, ';
    					} else {
    						$content .= '<a>' . ($i + 1) . '</a>, ';
    					}
    				}
    				
    				// Einde pagina's
    				$content = substr($content, 0, -2) . '&lt;/p&gt;';
    			}
    		}
    		
    		return $content;
    	}
    	
    	genesis();
  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble