function get_twitter_feed(){
$userID = 'ImOttoman'; //your twiter username
$url="http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=$userID&count=1";
$xml = simplexml_load_file($url) or die("could not connect");
foreach($xml->status as $status){
$text = $status->text;
}
echo $text;
}
add_filter('wp_head','get_twitter_feed');
You never said where you want it so this just pops it into the head (not a great idea), and is a bad example lol.
Instead you should use the HTTP API and cache the results for at least 10 minutes.
Also you should just use a plugin for more features because there is NO difference between a plugin and functions.php.
Related Posts:
- Get list of years when posts have been published
- Redeclare a function in a child theme
- Is it possible to remove the “standard” post format?
- Do WordPress’ cron’s clean up expired transients?
- How to add first name & last name to default registration form?
- Masking logout URL
- How can I programmatically create “child” pages on theme activation?
- Add admin bar link to edit author
- Warning/Notice about functions.php
- How to include one class/instance without using global variables
- Modify search function in WordPress (TwentyTwelve)
- Is checking whether the blog is installed necessary?
- How to add CSS style sheet dynamically in wordpress
- How to update BuddyPress xprofile fields programmatically? [closed]
- Replace Archive Widget Link Text
- A snippet after every image
- How can I add an image field to BuddyPress Extended Profile Fields? [closed]
- wp_remote_post with ssl:// protocol
- Searching for content post
- Using separate .php file for functions – how to run on site?
- How to include local menu based on page id?
- How to add custom fields to my custom registration form
- Add Featured image column into wordpress admin on pages AND posts
- How can I change the do_action function in footer (copyright area)
- How to display post content instead of excerpt
- Access Plugin data from Functions.php
- Override a theme function in a child theme?
- changing behaviour of get_search_form
- how to call a function only in specific pages and exclude it from other pages
- Which action does wp_update_user triggers?
- Include default functions and methods
- Use register_setting() in a loop
- Dynamic dropdown from database table
- Add dynamic links in WordPress custom theme
- WordPress website Rs changed to currency symbol
- Functions in custom theme
- Please Explain the Importing Process of Multiple Stylesheets for Child Themes
- Attempt to change jQuery version caused White Screen of Death
- check if author has published posts in custom post type, then send mail
- paginate_links() don’t properly work in search.php?
- How can I get the post id from within functions.php
- Check if Page Slug Exists, then display that Page’s Title
- Why doesn’t is_page(id) work in functions.php?
- Does code run faster in functions.php than in different theme templates?
- Enqueuing latest version of jQuery into a child theme returns a blank screen
- Function to alphabetically sort custom post types creating duplicates
- get_post_meta() problem again
- Update users custom profile fields
- How to parse a shortcode within a shortcode?
- Variables not showing in short code
- Add back in child theme what the parent theme removed with remove_action
- replace text in Sort Box
- login_headertitle is deprecated since version 5.2.0
- Prevent loading of functions
- Where is this JQuery coming from?
- Different favicon on different pages
- Shortcode question
- call_user_func_array() expects parameter 1 to be a valid callback, function
- What is the better for call files: bloginfo() or echo esc_url()?
- WordPress website keeps loading the maintenance page
- Setting Permalinks in wp_config or functions file?
- loginout function customization
- define css class in functions.php
- Adding tables to the WordPress Editor
- Add Login and logout buttons to top menu bar
- Dashboard blocker on network multisite for specific user roles
- How to place a div inside a function that creates a div
- Echo post title in post
- dynamic enquiry form [closed]
- implementing a centralized content “show-do-not-show” toggle?
- How would I make a function to dynamically determine if user is logged to change navigation menu text?
- How to redirect Subscribers on login to specific page, when logging in from a Page
- How to load a css file depending on the current role
- How to change images url in function.php?
- Which filter fires upon setting a featured image
- Add a word after the post url if it is within a specific category
- Probleme shortcode with list author
- Security when outputing wp_oembed_get code
- Stylesheet does not load despite functions.php
- How to show only specific category post by user role without plugin and restrict all other cats
- Shortcode to output category description by passing ID
- Unable to declare AOS library in functions
- Removing sanitize_title_with_dashes Function with The Real Title
- Will dequeueing in child theme functions.php file prevent Google Fonts from loading?
- Graphic before title – Specific Category
- Printing medium sized image
- Edit meta fields from within template
- WordPress Jquery+scripts enqueue issue
- Adding a meta box fields to child theme options page
- Adding a jQuery rotator function
- How to programmatically GET (to know) which Sidebar (or) which Menu is being used on Different Pages?
- Can’t change excerpt length and more tag
- Remove theme, change theme button and WP version on “Right Now” admin dashboard?
- Making an under maintenance page (without using plugins)
- Image width issue in IE [closed]
- Changed functions.php file and now site is blank [closed]
- How do i set global variable in a function in wordpress functions.php
- Working function() doesn’t execute when triggered by WP CRON
- WordPress – Notice: Function wp_enqueue_script was called incorrectly
- post_row_actions filter from parent theme not executing in child theme