How to fetch and display WordPress plugin information

Showing information from a plugin hosted on wordpress.org

Example of the information in this script that is displayed.

A simple piece of code to fetch plugin information about any plugin hosted on wordpress.org and display on your own website. If you have built your own plugins and publish them on wordpress.org, you might want to display some basic stats about the plugin.

With this shortcode you can show the basic details on your website. I am using the same code to display the plugin information on Delete Duplicate Posts plugin page.

The output is cached for an hour, so the data is not refreshed on each pagevisit. As you might want to use the shortcode for different plugins, there is a unique CSS id generated for each plugin as well as the more general CSS class “plugin-data”. See below CSS code for more details.

The code is mixed from different sources and in the process I lost the links, so if you recognize the code please let me know so I can set up proper attribution.

[et_pb_code admin_label=”Code”]<script src=”https://gist.github.com/lkoudal/7a394e1f314687a6fedbd9a0e1d9b2af.js”></script>[/et_pb_code]

CSS Styling

Some CSS styling is needed to make the shortcode look good. Instead of editing the text output, I added text via CSS.

For instance, the text “Downloaded xx,xxxx times”, I added “Downloaded” and “times” using the :before and :after pseudo CSS classes.

 

 

[et_pb_code admin_label=”Code”]<script src=”https://gist.github.com/lkoudal/d21cc2db86a342b2870f289a2c05691b.js”></script>[/et_pb_code]

Do you develop for WordPress? Check out some of the other posts here: WordPress Optimization Tips – header.php or 301 redirects for 404 spam pages – WordPress Style – more can be found in the blog.

 

About Lars Koudal

My name is Lars Koudal and I work as a WordPress Consultant and SEO analyst.Born and raised in Denmark I moved to Barcelona in 2008 and in 2015 I moved to Miami.

Cleverplugins.com Newsletter

Articles about how to improve your WordPress website, how to get more traffic and most importantly more customers.

Subscribe

Something went wrong. Please check your entries and try again.