WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Gigs Calendar] Substitute Feedburner RSS Feed (3 posts)

  1. Christine Cobb
    Member
    Posted 4 years ago #

    Can a Feedburner RSS url be substituted for the one listed under the events list? If so, can you give the code replacement. Thanks.

  2. schwarzbox
    Member
    Posted 4 years ago #

    Well, here is the quick way: go to your gig calendar's template directory, which reside either in

    wp-content/plugins/gigs-calendar/templates/[chosen]/

    or if you customized it in

    wp-content/gigs-templates/[chosen]/

    and look for an file name rss.php. Open it and you will see

    <?php if ( $options['rss-link'] ) : ?>
    	<div class="gigs-rss"><a href="<?php echo $folder ?>rss.php"><?php _e('Subscribe to RSS calendar feed', $gcd); ?></a></div>
    <?php endif; ?>

    Replace <?php echo $folder ?>rss.php with your Feedburner RSS.

    A less trivial but cleaner solution (better browser support for the file downloaded) would be to add a LINK-tag to the header of the html output. This should be done anyways, no matter of the feed provider!

    Open

    wp-content/plugins/gigs-calendar/gigs-calendar.php/

    and at line 66 (somewhere around there, at least) you should be able to see

    function display_css() {
      $options = get_option('gigs-calendar');
      $folder = dtc_gigs::get_url() . 'templates/';
      if ( is_file(dirname(__FILE__) . '/templates/' . $options['template'] . '/style.css') ) {
      ?>
      <link type="text/css" rel="stylesheet" href="<?php echo $folder . $options['template']; ?>/style.css" />
      <?php
      } elseif ( is_file(ABSPATH . 'wp-content/gigs-templates/' . $options['template'] . '/style.css') ) {
      ?>
      <link type="text/css" rel="stylesheet" href="<?php echo get_bloginfo('wpurl') . '/wp-content/gigs-templates/' . $options['template']; ?>/style.css" />
      <?php
      } else {
      ?>
      <link type="text/css" rel="stylesheet" href="<?php echo $folder; ?>basic/style.css" />
      <?php
      }
    }

    Go to the end of that function right before the last } and insert the following code:

    // EDIT START:
    global $gcd;
    $feedburner_rss_url = "";
    $title = __('Upcoming Gigs feed', $gcd) . " | " . get_bloginfo('name');
    if (!empty($feedburner_rss_url)) {
      ?>
      <link rel="alternate" type="application/rdf+xml" title="<?php echo $title ?>" href="<?php echo $feedburner_rss_url?>" />
      <?php
    } elseif ( is_file(dirname(__FILE__) . '/templates/' . $options['template'] . '/style.css') ) {
      ?>
      <link rel="alternate" type="application/rdf+xml" title="<?php echo $title ?>" href="<?php echo $folder . $options['template']; ?>/rss.php" />
      <?php
    } elseif ( is_file(ABSPATH . 'wp-content/gigs-templates/' . $options['template'] . '/rss.php') ) {
      ?>
      <link rel="alternate" type="application/rdf+xml" title="<?php echo $title ?>" href="<?php echo get_bloginfo('wpurl') . '/wp-content/gigs-templates/' . $options['template']; ?>/rss.php" />
      <?php
    } else {
      ?>
      <link rel="alternate" type="application/rdf+xml" title="<?php echo $title ?>" href="<?php echo $folder; ?>basic/rss.php" />
      <?php
    }
    // EDIT END

    Now, if you do not touch the rss.php of your chosen template, the rss-feed of gigs calender will be linked in the header and the feed is delivered by the wp-server.

    If you edit the rss-file to have your feedburner-feed served and you inserted the code above, you must set the $feedburner_rss_url to the same URL that you entered in the rss.php!

    $feedburner_rss_url = "http://http://feeds2.feedburner.com/someentryhere";

  3. schwarzbox
    Member
    Posted 4 years ago #

    Though it'll work, I forgot something. The type of the feed should be edited as well and set to type of the (external) feed. So this is the code to insert:

    // EDIT START:
    global $gcd;
    $feedburner_rss_url = "";
    $feed_type = "rss";
    $title = __('Upcoming Gigs feed', $gcd) . " | " . get_bloginfo('name');
    if (!empty($feedburner_rss_url)) {
      ?>
      <link rel="alternate" type="application/<?php echo feed_type; ?>+xml" title="<?php echo $title ?>" href="<?php echo $feedburner_rss_url?>" />
      <?php
    } elseif ( is_file(dirname(__FILE__) . '/templates/' . $options['template'] . '/style.css') ) {
      ?>
      <link rel="alternate" type="application/<?php echo feed_type; ?>+xml" title="<?php echo $title ?>" href="<?php echo $folder . $options['template']; ?>/rss.php" />
      <?php
    } elseif ( is_file(ABSPATH . 'wp-content/gigs-templates/' . $options['template'] . '/rss.php') ) {
      ?>
      <link rel="alternate" type="application/<?php echo feed_type; ?>+xml" title="<?php echo $title ?>" href="<?php echo get_bloginfo('wpurl') . '/wp-content/gigs-templates/' . $options['template']; ?>/rss.php" />
      <?php
    } else {
      ?>
      <link rel="alternate" type="application/<?php echo feed_type; ?>+xml" title="<?php echo $title ?>" href="<?php echo $folder; ?>basic/rss.php" />
      <?php
    }
    // EDIT END

    An these are the lines you have to edit to use external feed providers:

    $feedburner_rss_url = "http://feeds2.feedburner.com/someentryhere";
    $feed_type = "rss"; // usually rss, rdf or atom

Topic Closed

This topic has been closed to new replies.

About this Topic