how to build a simple wordpress plugin to announce a new url or facebook page

15
How To Build a VERY Simple WordPress Plugin Add any content to the end of ALL of your blog posts. By Bruce Chamoff

Upload: bruce-l-chamoff

Post on 15-Apr-2017

120 views

Category:

Internet


0 download

TRANSCRIPT

Page 1: How To Build A Simple WordPress Plugin To Announce a New URL or Facebook Page

How To Build a VERY Simple WordPress Plugin

Add any content to the end of ALL of your blog posts.

By Bruce Chamoff

Page 2: How To Build A Simple WordPress Plugin To Announce a New URL or Facebook Page

About Bruce ChamoffCEO of Hot Web Ideas, Inc, hotwebideas.net, a New York

based web development firm of over 20 years with a portfolio of over 1,000 websites including Korg, JP Morgan Chase, Whirlpool, UBS

A WordPress theme and plugin developer of 9 yearsInstructor on 5 Udemy.com WordPress Development CoursesA contributor to the WordPress.org development forumsSpeaker at WordCamps all over the United StatesDad with one daughter.

Page 3: How To Build A Simple WordPress Plugin To Announce a New URL or Facebook Page

What Will This Plugin DoSuppose your have a blog of over 100 blog

posts and you start a new Facebook page. Wouldn’t it be nice to have a simple plugin that will tell your readers to visit and like the page at the end of every blog post?

You can with this plugin. This plugin will prevent the need to manually edit every single blog post.

Page 4: How To Build A Simple WordPress Plugin To Announce a New URL or Facebook Page

All the code you need:<?php

/*headerPlugin Name: Add My URLDescription: Add any URL to the end of all WordPress posts and pagesVersion 1.0Author: Bruce ChamoffAuthor URL: http://www.hotwebideas.net*/

// hookadd_filter(‘the_content’, ’add_my_website’);

//callback functionfunction add_my_website($content){

$new_content = $content . ‘<p><a href=“http://www.hotwebideas.net”>Visit My Website</a></p>’;

return $new_content;}

?>

Add Your URL To All Posts and Pages

Website: WebDesignerMall.com / WordPress.org: hotwebideas / Twitter:@brucechamoffI teach WordPress Development Courses at http://udemy.com/user/brucechamoff

Page 5: How To Build A Simple WordPress Plugin To Announce a New URL or Facebook Page

How To Customize This Plugin1. Look at the slide titled All the code you need

or click this link.2. Open your favorite text editor and copy the

PHP code to a new file.3. Save the file as specialid_add_to_the_end.php

where specialid can be any ID you want such as hwi_add_to_the_end.php

Page 6: How To Build A Simple WordPress Plugin To Announce a New URL or Facebook Page

How To Customize This Plugin (continued)

Customize the header:/*headerPlugin Name: Add My URLDescription: Add any URL to the end of all WordPress posts and

pagesVersion 1.0Author: Bruce Chamoff replace with your nameAuthor URL: http://www.hotwebideas.net replace with your URL*/

1. Change the author nameto YOUR name.

2. Change the URL to YOURURL or social media page.

Page 7: How To Build A Simple WordPress Plugin To Announce a New URL or Facebook Page

How To Customize This Plugin (continued)

Customize the callback function://callback functionfunction add_my_website($content){

$new_content = $content . ‘<p><a href=“http://www.hotwebideas.net”>Visit My Website</a></p>’;

return $new_content;}

2. Change the call to action to any thing you want.

1. Change the URL to your new site or social media page.

Page 8: How To Build A Simple WordPress Plugin To Announce a New URL or Facebook Page

Installing Your New PluginNow, you can upload it to your WordPress site. Follow these steps:

1. Save your plugin as a zip file.

2. Log into your WordPress admin.

3. Click on PluginsAdd New.

4. Continued on next page.

Page 9: How To Build A Simple WordPress Plugin To Announce a New URL or Facebook Page

Installing Your New Plugin (Continued)

Click Upload Plugin.

Page 10: How To Build A Simple WordPress Plugin To Announce a New URL or Facebook Page

Installing Your New Plugin (Continued)

Click Choose File.

Page 11: How To Build A Simple WordPress Plugin To Announce a New URL or Facebook Page

Installing Your New Plugin (Continued)

Navigate to your zip file and double-click it.

Page 12: How To Build A Simple WordPress Plugin To Announce a New URL or Facebook Page

Installing Your New Plugin (Continued)

Click Install Now.

Page 13: How To Build A Simple WordPress Plugin To Announce a New URL or Facebook Page

Activating Your New Plugin (Continued)

Click Activate Plugin.

Page 14: How To Build A Simple WordPress Plugin To Announce a New URL or Facebook Page

Activating Your New Plugin (Continued)

Congratulations! Your new plugin is activated and should now display your new URL at the end of every blog post!

Page 15: How To Build A Simple WordPress Plugin To Announce a New URL or Facebook Page

Contact & Q&AContact Me For Plugin Help

Twitter @BruceChamoff WebDesignerMall.com Udemy.com

http://udemy.com/user/brucechamoff Get 50% Off My WordPress Development

courses with coupon code WORDCAMPI will answer any question…Website: WebDesignerMall.com / WordPress.org: hotwebideas / Twitter:@brucechamoffI teach WordPress Development Courses at http://udemy.com/user/brucechamoff