I want to code a plug-in that creates new custom home page. Note that I have never coded any plug-in before.

1) After activation of plug-in user needs to go to the options of the plug-in and set up that current home page will be replaced by the one that this plug-in generates ( I hope I can code this bit somehow in the future )

2) Plug-in generates custom home page that displays only

  • title and body of the latest post
  • number of comments

Could someone help me how to code the 2) ?

Currently I have one php file that is very simple plug-in. I can activate / deactivate it but I don't know how to code the home page.

I'll be using WP 3.6


An Active Plugin

To make an active plugin, use the following resources:

From the following StackExchange thread, try to understand what are the Hooks and what are things acting behind a plugin:

Template Hiearchy

Then you will need to learn the WordPress Template Hierarchy. For WordPress Template hierarchy consult the Codex page for Template Hierarchy#In Detail. Get idea about the Home Page Display and Front Page Display template settings.

Custom Home Page

Now try to find out a way to make your own custom home page. Use whether the front-page.php or home.php template and display your own homepage. Hook to wp_head() on the header.php to echo your custom codes/ custom template other than the default one. Hook some code to overwrite the Settings > Reading rules in WP-Admin.

REMEMBER: All work and no play makes Jack a dull boy - so implement, initiate, and integrate what you've learnt. Don't wait to someone will appear with a bunch of code and you'll paste 'em to make your own. "cerca trova" - "Seek and ye shall find". Good luck.

  • Great lead! Now my plug-in outputs html before the theme does. But how can I make it so the current theme doesn't output anything? – Radek Aug 17 '13 at 2:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.