Skip to content
Coding Friends

Coding Friends

Coding Friends, place for developers.

Search

Categories

  • About me (and thoughts!) (3)
  • Containers (1)
    • Docker (1)
  • DevOps (3)
  • Firefox (4)
  • General (2)
  • Hosting (2)
    • CertBot (2)
  • Languages (239)
    • C / C++ (74)
    • C Sharp (c#) (35)
      • Silverlight / moonlight (2)
    • Flex Flash (2)
    • HTML & CSS (10)
    • Java (41)
    • Javascript (21)
    • PHP (49)
      • Laravel (1)
    • Python (6)
    • Ruby (7)
    • SQL (Structured Query Language) (9)
    • Visual Basic (1)
  • Linux (33)
    • Bash (2)
    • Linux install and configurations (13)
    • Ubuntu/Kubuntu (2)
    • Video (7)
  • Operating Systems (1)
  • Windows (9)
    • Azure (5)
    • Windows install and configuration (2)
  • Wordpress (2)
  • Cookie Policy
  • Operating Systems
    • Linux
    • Ubuntu and Kubuntu
    • Windows
  • Programming
  • Projects
    • 2D/3D - Game
    • 3D spinning computer
    • Kernel
    • Lessons on programming
    • Word search
    • XML reader - c++
  • Thinking out loud - About me and this site
  • Thinking out loud - Common problems
  • Thinking out loud - Projects ideas

Custom wordpress page on a new URL

I liked to have the idea of having google search my site and have it displayed within my current site design, and since wordpress allows to have action hooks that allow you to interrupt the present flow of generating the wordpress outputted page.

So to have the google searched and display results within the style that I am using I first needed to create a plugin, if you create a file within your

wordpress base directory/wp-content/plugins/codingfriendsgooglesearch

within the file below within the that directory created above, (I saved this file as googlesearch.php, but it does not matter as long as it is a .php file with the plugin details at the top of the file between the /*… */ parts.

What basically happens is when the template_redirect is called, this is when most of the processing of the page has already been done, and we are about to display the requested page from the blog, well in this case I would like to add function call to google_search_display, which is within this same file, and what it does is to search for ‘googlesearch/’ within the first part of the URL requested e.g.

http://www.codingfriends.com/googlesearch/

and if so display the googlesearch.php php file from within the templates directory, and here is my googlesearch.php file, and it displays the content within the div tag with cse-search-results, with the present style around the google search results.


wordpress is really nice where you are able to alter the present execution process.

Posted on September 6, 2010September 6, 2010Author genuxCategories PHPTags action hook, google search, Wordpress

Leave a Reply

Your email address will not be published. Required fields are marked *

Post navigation

Previous Previous post: CS107 – Assignment 2 – Six degrees
Next Next post: CKEditor – Custom upload dialog
Proudly powered by WordPress