• 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>';
}
?>

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, 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

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • WordPress & PHP : Different AdSense Units on Mobile Devices

    Here is How To Serve Different AdSense Units on Mobile Devices on WordPress With PHP. WordPress Has Function Which Can Be Used In Free Way.

  • WordPress Custom Dashboard Widget Sample

    Here is a Working WordPress Custom Dashboard Widget Sample Fully Compliant With Official WordPress Documentation For Doing Anything You Need.

  • Best Android Widgets – Biggest Collection of Android Widgets

    Best Android Widgets like battery widgets, email Widgets, photo widgets, Weather Widgets, Clock Widgets are categorically posted along with description.

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

Get new posts by email:

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 (24.3K Followers)
  • Twitter (5.8k 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

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

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

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