4 Examples of Building with WP API

APIs or application programming interface provide you with a way to integrate services or features with your website. Before APIs, you need to partner with companies in order to use their code in your website or app. You have a WordPress website. Can you use an API to create additional features? With their WP API, you can build solutions unique to your WordPress website.

4 Examples of Building with WP API

What can you do with WP API?

You can use the WP API to build solutions that integrate with WordPress or use it as a back-end database. Maybe you need to create new features that talk to an external API. I found four examples that show you how to use the WP API to integrate with WordPress and an external API for Instagram.

Fetch Random Posts

Chris Coyier demonstrates how to use the WP API to randomly fetch posts from WordPress. In his example, he uses WordPress to store quotes about design and randomly displays one to you.

Screenshot of Quotes On Design Website

Go to Quotes on Design to see the api at work.

Retrieving Posts in C#

What if you want to use the WP API with a different programming language? With WP API, you can use a programming language like C# instead of PHP to retrieve posts from WordPress. Hendrik Bulens chose to use ASP.NET MVC as the front end to retrieve the latest blog posts from WordPress.

Voting for Blog Posts

You spend time writing blog posts and want to allow your readers to vote on whether or not they liked the post. In the past, you need to write a plugin using PHP. You can use WP API to accomplish this. Use this example from Delicious Brains to create your blog voting.

Integrate WordPress with Instagram

If you use Instagram, you may want to include photos from your account. WebDev Studios show you how to use the API to integrate Instagram with WordPress.

Summary

These examples show you how to use WP API to modify WordPress and work with an external API. If you want to learn more, Chris Lema has a guide that contains resources and tutorials on Getting Started with APIs and WordPress. You can also check out Getting Started with using an API.

4 Ways to Add Code Snippets to Your Blog

When you write a blog post that features code, you’ll want to show your code. But, you don’t want it to act like code. What are your choices for adding code to a blog post? You can manually show your code, use a plug-in or embed it into your post. Which one do you choose?

4 Ways to Add Code Snippets to Your Blog

1. Code it manually yourself

Write the code to style it yourself without using a plug-in or hosting your code on another website. You can create a code snippet with HTML and CSS. With the HTML tags <pre> and <code> and CSS, you can style your snippet to work with your design.

Code Snippets in HTML and CSS

2. Use a plug-in

If you prefer not to code it yourself, your next option is to use a plug-in. For WordPress, you can use a plug-in called Code Snippets. With Code Snippet, you can manage your snippets easily.

Code Snippets WordPress Plugin

3. gist.github.com

Don’t want to code it yourself or use a plug-in and you have a github account? You can host your code on gist.github.com. They provide you with a way to embed code snippets on your blog.

gist.github.com

4. CodePen

Are you a CodePenner? If you are and have a self-hosted WordPress blog, you can embed your pens or use the CodePen Plugin. CodePen takes care of the code and formatting for you. Refer to CodePen’s documentation on the best method for you.

CodePen Embed & WordPress Documentation

Summary
Whether you create code snippets with code, use a plugin or host on gist.github.com or CodePen, these methods provide 4 different ways to show your code.

8 Ways to Freshen Up Your Blog

You keep your blog current by writing new blog posts. As you write more posts, you may decide to change the focus of your blog. Or you want to make some minor changes. What can you do to freshen up your blog?

You can tackle it in two ways: maintenance and tweaking your blog.

Freshen Up Your Blog

Maintenance

As you continue to write and create posts for your blog, your website can start to slow down or links no longer work. You should take this time to do some routine maintenance on your blog.

Broken Links

Websites change their links, remove content or go permanently away. You need to check your site for broken links. If you have WordPress, use the Broken Link Checker to find them. If you are using a different CMS, try W3C Link Checker.

Clean up your sidebar

Is your sidebar working for you? Look at the items in your sidebar and decide if you have links, forms or products ads that need to be updated or removed. You may want to replace them with links to recent or popular posts or a signup to your newsletter.

Clean up WordPress

Your WordPress database over time can get messy. You add, edit and delete posts. You manage comments by editing or deleting spam. This can cause your database to become bloated and slow.

After cleaning or optimizing your database, you should update any plugins and themes that you use. Then, delete any plugins you are no longer using.

Tweak Your Blog

By updating your blog with simple changes, you can help to freshen up the content of your posts.

Update Graphics and Photos

Are your photos and graphics working for you? You may want to change them out for higher quality photos. Pick out pictures that work better for your blog and brand. You can use one of the sites mentioned on the The Badass List of Free Stock Photos Websites for Designers or take your own photos.

Add headings to your posts

When you first wrote your posts, you may not have used heading. Headings are a way to organize and highlight important information. They range from H1 to H6. Headings allow you to break up your post into easily readable and scannable chunks.

Add call to actions

You can use clickable buttons to let your readers know what action to take. You may want them to sign up for your newsletter, contact you or buy a product from you. Adding clickable buttons is a great way to get your readers to engage with you.

Add pull quotes

Create a pull quote to jazz up your design and draw your reader’s attention to an important idea. Use these tips to draw your readers attention with pull quotes.

Summary

Regular maintenance helps to keep your blog running smoothly. By changing photos, adding headings, pull quotes and calls to action, you can update old posts and improve your relationship with your readers.

Photo Credit: http://startupstockphotos.com/

5 Places to Get WordPress Snippets

How can you modify your WordPress website? By adding a theme, plugins or modifying WordPress yourself. When you develop your own WordPress websites, you may want to add code instead of relying on a plugin. Adding a code snippet to your theme or a custom plugin can be a better solution than searching for a plugin that does what you want. Where do you find these code snippets, what do you do if it breaks your site and how to do manage them?

5 Places to Get WordPress Snippets

Where do you find code snippets?

WPSNIPP

WPSNIPP – WordPress Snippets has a collection of about 666 snippets. You should be able to find a snippet that works for your next project.

wpsnipp

 

Digging Into WordPress

Digging Into WordPress has tips, tricks and snippets for modifying and making your WordPress site even better. You can use their tips and tutorials to replace plugins that could do the same thing.

Digging Into WordPress

 

WP-Mix

WP-Mix is a mix of code snippets and tutorials. You will find WordPress, PHP, jQuery, HTML, CSS and more.

WP-Mix

 

CSS-Tricks

CSS-Tricks has a collection of WordPress snippets. You can add these snippets to your theme or a site-specific plugin.

CSS-Tricks WordPress Snippets

The Web

You can search the web for a code snippet. Many WordPress or developer blogs will have code snippets that you can use.

What happens when you find one and it breaks your site?

WP Beginner explains how to paste snippets from the web into WordPress and how to avoid mistakes that could take your site down.

What do you do with your code snippets?

Whether you have written or found a WordPress snippet that you want to share, you need a way to do it. Thoriq Firdaus show you how in How to Manage and Use Snippets in WordPress.

Code snippets can make it easier for you to modify WordPress. You can search and paste snippets into your WordPress site. Where and how you paste these snippets can determine whether or not it will fix your problem or crash your website. As with all code you find, read it to make sure you understand what it does and test it. Do you have a place where you can find WordPress code snippets?

How is a WordPress Plugin Reviewed?

You created a WordPress plugin and submitted it to the Plugin Repository. What happens when you submit your plugin for review? How does WordPress review plugins?

How does WordPress Review Your Plugin

Mika Epstein at WordCamp Atlanta 2016 explains the process.

How do you prevent your plugin from being rejected?

  • Give your plugin a unique name. Don’t use “plugin” or “WordPress” in the name.
  • Avoid using Trademarks. Company or product names may be trademark. If you want to use Google Analytics as part of your name, you can’t because it is trademarked.
  • Don’t steal another developer’s plugin and pass it off as your own. If you are modifying or forking another plugin, credit the owner of the original and change the code so they can see that you made changes to it.
  • Make sure your code does things the way WordPress expects. They may reject your code if you don’t sanitize your data, hard code calls to WordPress directories or don’t document that your plugin uses calls to third party api’s or plugins.
  • Seven Day Rule. Communicating with your plugin reviewer is key. They may reject your plugin if you don’t respond to your reviewer after seven days.

Reviewing your plugin can be a long process. Every plugin is reviewed by a live person; it is not automated. Working closely with your plugin reviewer, helps you to fix problems and get through the process more quickly. Remember, they actually read the code and test it to make sure it works. You can make your chances of being accepted by doing the following: use a unique name, avoid using trademarks, give credit to others when you use their code and review your code to make sure it does things the way WordPress expects.