• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » WordPress Dashboard Widget Custom Feed

By Abhishek Ghosh June 18, 2015 12:32 am Updated on June 18, 2015

WordPress Dashboard Widget Custom Feed

Advertisement

We Can Add Any PHP Feed Aggregator Snippet in Our Example WordPress Dashboard Widget’s Source To Get WordPress Dashboard Widget Custom Feed. Where is that Example WordPress Dashboard Widget? The Example WordPress Dashboard Widget is here. Actually with that same thing, we iframed Google Trends Graph. It will not interfere the default functions of other widgets.

 

WordPress Dashboard Widget Custom Feed : The PHP Snippet For Fetching Feed

 

There are many ready to use libraries to fetch feed. SimplePie is well known, it very easy to use Free Software and easy-to-use feed parser. This is an easy snippet to fetch feed :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
$rss = new DOMDocument();
$rss->load('https://thecustomizewindows.com/feed/');
$feed = array();
foreach ($rss->getElementsByTagName('item') as $node) {
$item = array (
'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue,
);
array_push($feed, $item);
}
$limit = 5;
for($x=0;$x<$limit;$x++) {
$title = str_replace(' & ', ' &amp; ', $feed[$x]['title']);
$link = $feed[$x]['link'];
$description = $feed[$x]['desc'];
$date = date('l F d, Y', strtotime($feed[$x]['date']));
echo '<p><strong><a href="'.$link.'" title="'.$title.'">'.$title.'</a></strong><br />';
echo '<small><em>Posted on '.$date.'</em></small></p>';
echo '<p>'.$description.'</p>';
}
?>

The URL in the line $rss->load('https://thecustomizewindows.com/feed/'); should be changed to own intended URL. You will get the same file on GitHub repo. Copy Paste from there in any Text Editor.

Advertisement

---

There are more advanced Feed Fetchers, this is a basic example to get WordPress Dashboard Widget Custom Feed.

WordPress Dashboard Widget Custom Feed

 

WordPress Dashboard Widget Custom Feed : Making it Working With Example Dashboard Widget

 

You need to install that Example Dashboard Widget. Read the article carefully and install it or modify and install it. We are taking that you have already installed it, so you will modify directly on WordPress Plugin Editor. Actually we can directly do it from WordPress using the WordPress Plugin Editor, URL will be like this :

Vim
1
example_dashboard_widget/widget.php

From the dropdown, select Example Dashboard Widget if you are using our default WordPress plugin. If you have changed the name, that will be the name. Click the select button. The file which you™ll edit is :

Vim
1
example_dashboard_widget/widget.php

Just simple editing of a plugin file. You’ll remove everything including these lines and add the PHP Feed Generator snippet :

example_dashboard_widget/widget.php
Vim
1
2
3
4
5
6
<?php
/**
* This file could be used to catch submitted form data. When using a non-configuration
* view to save form data, remember to use some kind of identifying field in your form.
*/
?>

PHP ending and closing not required as we have it on our Feed Snippet, So the widget.php file is becoming like :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
$rss = new DOMDocument();
$rss->load('https://thecustomizewindows.com/feed/');
$feed = array();
foreach ($rss->getElementsByTagName('item') as $node) {
$item = array (
'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue,
);
array_push($feed, $item);
}
$limit = 5;
for($x=0;$x<$limit;$x++) {
$title = str_replace(' & ', ' &amp; ', $feed[$x]['title']);
$link = $feed[$x]['link'];
$description = $feed[$x]['desc'];
$date = date('l F d, Y', strtotime($feed[$x]['date']));
echo '<p><strong><a href="'.$link.'" title="'.$title.'">'.$title.'</a></strong><br />';
echo '<small><em>Posted on '.$date.'</em></small></p>';
echo '<p>'.$description.'</p>';
}
?>

This Article Has Been Shared 492 Times!

Facebook Twitter Pinterest
Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Orthopaedic Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to WordPress Dashboard Widget Custom Feed

  • Showing Open Graph Protocol og image, og description Properly

    Showing Open Graph Protocol og image, og description properly can be a challenge – either proper post specific og image is not shown or description is chopped.

  • Remove WordPress Plugin From Database

    Remove WordPress plugin from database which is/are previously used but no longer required might not be as simple as going to Plugins page and deleting it.

  • Podcast and WordPress : Tips

    Podcast and WordPress can make the older posts more lively again. A small introduction Podcast can increase the conversion. Here is a detailed guide.

  • Choosing WordPress and HTML Template for a Website

    Choosing WordPress and HTML Template for a Website is not really that easy that it might sound. This quite difficult as both has limitations of their own.

  • Post Specific Widget with Semantic Markup for WordPress

    Post specific widget with Semantic Markup for WordPress is a kind of template Plugin for more flexibility. You can create infobox like Wikipedia.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

You can subscribe to our Free Once a Day, Regular Newsletter by clicking the subscribe button below.

Click To Subscribe

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (21K Followers)
  • Twitter (5.3k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Best Powerpoint Templates for Communicating IoT Concepts April 17, 2021
  • How to Build a DIY Water Level Indicator? April 16, 2021
  • How Startups Can Convince the Investors April 14, 2021
  • What to Know About the Cloud Storage Services for Smartphones April 13, 2021
  • WonderFox HD Video Converter Factory Pro Review April 10, 2021

 

About This Article

Cite this article as: Abhishek Ghosh, "WordPress Dashboard Widget Custom Feed," in The Customize Windows, June 18, 2015, April 18, 2021, https://thecustomizewindows.com/2015/06/wordpress-dashboard-widget-custom-feed/.

Source:The Customize Windows, JiMA.in

 

This website uses cookies. If you do not want to allow us to use cookies and/or non-personalized Ads, kindly clear browser cookies after closing this webpage.

Read Cookie Policy.

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2021 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy