Connect with us

Tips & Tricks

Use WordPress to print a RSS feed for Eventbrite attendees

Published

on

Today I was working on the WordCamp.LA site. I was trying to show the “attendee list” on the attendees page with out having to update the page every day.

Since I am using EventBrite to promote and sell ticket to the event I can collect info from there list. Evey one who purchases a ticket gets put into the ticketed database which you can view with either RSS or OPML.

I chose to use RSS and the WordPress core file rss.php.

In the functions.php file I’ve added this function:

function attendee_feed_print_2009() {
	global $wpdb;
		include_once( ABSPATH . WPINC . '/rss.php' );
		$rss = fetch_rss( 'http://www.eventbrite.com/rss/event_list_attendees/384870157' );
		$items = array_slice( $rss->items, 0 );

Where I’ve named my function, and included the core RSS file from WordPress. I also told it to fetch the feed from the address (alternatively you can use any feed link you like).

if ( empty( $items ) ) echo '<ul style="list-style-type: none; list-style-image: none; list-style-position: outside;"><li>No items</li></ul>';

 else

 foreach ( $items as $item ) : ?>
 <ul style="list-style-type:none; list-style-image:none; list-style-position:outside; margin-bottom: 0px">
 <li><!--<strong><?php echo $item[ 'title' ]; //User name ?></strong><br />-->

 <?php echo $item[ 'content' ][ 'encoded' ]; ?>

 <hr style="border: 1px solid #ddd; margin-bottom: 8px" />
 </li>
 </ul>
 <?php endforeach;

I then added the core style to fit this current feed.

And the final out come looks like this:

function attendee_feed_print_2009() {
 global $wpdb;
 include_once( ABSPATH . WPINC . '/rss.php' );
 $rss = fetch_rss( 'http://www.eventbrite.com/rss/event_list_attendees/384870157' );
 $items = array_slice( $rss->items, 0 );
 if ( empty( $items ) ) echo '<ul style="list-style-type: none; list-style-image: none; list-style-position: outside;"><li>No items</li></ul>';

 else

 foreach ( $items as $item ) : ?>
 <ul style="list-style-type:none; list-style-image:none; list-style-position:outside; margin-bottom: 0px">
 <li><!--<strong><?php echo $item[ 'title' ]; //User name ?></strong><br />-->

 <?php echo $item[ 'content' ][ 'encoded' ]; ?>

 <hr style="border: 1px solid #ddd; margin-bottom: 8px" />
 </li>
 </ul>
 <?php endforeach;
}

Don’t forget to wrap the code in <?php ?>

I want to thank John Kolbert for helping me with printing the content:encoded portion. http://pastebin.com/m1588fb30

See it in action: http://wordcamp.la/attendees/

Tips & Tricks

Remove spaces when echoing the_title

Ever wanted to print or echo the WordPress title attribute without spaces?

Published

on

This little trick can be useful for calling custom functions and printing the title with out spaces for W3C compatibility. I used this trick in a new theme called Galleria, which will be out for public download in the coming days.

Using this comes in handy for a delicious text link:

<?php $title = get_the_title(); ?>
<a href="http://del.icio.us/post?url=<?php echo $title; ?>&amp;<?php echo str_replace(" ", "%20", $title); ?>">
Bookmark This (<?php echo $title; ?>)</a>

What I am doing is calling $title = get_the_title(); and using str_replace(" ", "%20", $title); to replace empty spaces with a %20, which is used in URL encoding empty spaces.

Alternatively you can use a dash or underscore.

Thanks to Jason Boyle for his adaption.

Continue Reading

Tips & Tricks

Display the_excerpt only if there is text

Have you ever wanted to display the excerpt only if you write one? A simple couple lines of code can display the_excerpt any where you like.

Published

on

In my new theme, I am using this coded trick to display the excerpt on a single post only if I’ve got text inside. Usually if you use the_excerpt and you don’t have one, it will fake one for you.

This is not something that I wanted to do on the single post page. So I used the following code to check if the excerpt existed.

if ( !empty( $post->post_excerpt ) ) :

Once this action is taken into account, you can factor in what code you want to out put if the post_excerpt isn’t empty.

if ( !empty( $post->post_excerpt ) ) :
	the_excerpt();
else :
	false;
endif;

The above code checks if there is an excerpt and print’s it to the screen. If there isn’t an except, it doesn’t do anything.

Continue Reading

Tips & Tricks

Add a shortcode

Published

on

This is a simple one.

/**
 * Your Blog title
 *
 */
function my_blog_title() {
	$blogname = get_bloginfo('name');
    return '<span class="blog-title">' . $blogname . '</span>';
}		  	
add_shortcode('blog-title', 'my_blog_title');

Just add this to your functions.php file and then add [blog-title] in any post or page and it will return your Blog Title. :)

Continue Reading

Random Search Terms

Title

Recent Posts: Fully Net Worth . com

Tony Beets Net Worth: How Rich is the Gold Miner Actually?

Tony Beets Net Worth: How Rich is the Gold Miner Actually?

Tony Beets is a Gold Miner and one of the most popular cast members on the reality series Gold Rush which airs on Discovery. He is known to be one of the biggest gold miners in Canada and owns the Tamarack Mine and Paradise Hills. As of 2019, Tony Beets net worth is estimated to […]

Robert Herjavec Net Worth

Robert Herjavec Net Worth

Robert Herjavec Net Worth.   Of all the famous global entrepreneurs, Robert Herjavec’s name tops the list. He is a Canadian investor, businessman, tv personality, author, and publisher. He founded a Canadian integrator of Internet security software, called the BARK systems, and sold it to AT&T Canada, now called Allstream Inc in the year 2000 […]

Azriel Clary Wiki, Parents, Bio: Where is Azriel Clary Now?

Azriel Clary Wiki, Parents, Bio: Where is Azriel Clary Now?

Azriel Clary is an American singer and one of R. Kelly’s alleged sex cult victims. Azriel met R. Kelly at the age of 17 and she convinced her parents to go on tour with him. Her parents allowed her to go on a trip with R. Kelly with a belief that he would mentor in […]

Mike Bibby Net Worth.

Mike Bibby Net Worth.

Mike Bibby Net Worth. Among the world-famous basketball players, Mike Bibby is undeniably one of the top players. He is, at present, a global personality. Mike Bibby is a national champion of the year 1997 and a Pac 10 1998 player in Arizona. He is one of the most highly regarded players of the National […]

Trending