How to customise a wordpress search result? - php

My friend started a blogging website using wordpress for students to write on topics like world affairs, british politics etc. He is a philosophy student so himself doesn't any coding or web development and hence asked me since I'm doing a computer science degree to help him modify the search on his website. Basically the issue is that the search works normally except when you want to use it to search by articles written by a specific author. For example if you write the name of a person, all the articles written by him/her should be displayed. I have no experience in web development but watched loads of videos on youtube on how to customise the search but most of them just show to change its position on the page or just how it looks and none the way I want to specifically customise it. Are there links to any videos on youtube or articles that explain how to do it or what should I do to customise the search in this way?
I have been telling him for the past week that I will help in because I was confident I would have solved the problem but since I actually started trying the past couple days, I've seen so many ways it could go wrong from ftp to messing up the whole website. I'm sure if it's not clear enough or my question is stupid, I thought for a while before posting this on stack overflow.

MODIFY YOUR THEME’S SEARCH.PHP FILE
What we want to do is first take a look at the current search results page. If your theme is not presenting a search bar to make an actual search query, then you can simply append the following to your site’s URL : yoursite.com/?s=your+search+string.
Passing this query will send you to the search results page. Ideally your query should actually produce results so you could try to use a general search phrase that you know will produce multiple results.
Once you have a good idea as to how the results looks now, you can visualize a clear direction as far as how you want it to look. The search.php file usually starts with the following link :
this link

Related

'#' creating a comment box that allows me to tag

I am creating a small blog-like website, and i would like to integrate the option to tag other users on comments or post using the # symbol like facebook or twitter does. I have searched throughout the website and haven't found anything similar nor do i know what this is called.
My question is, what programming language would i need to do this? taking in count that you can press the # symbol anywhere in the comment box, a list of your friends will pop up. i am making my website using PHP and MySQL. I would like to know any tips, tutorials or advice on how to do this.
In order to make a "#" functionality for your website will have to use ajax, PHP,and MySQL. Where ajax makes a call to a PHP file that pulls up and searches through the user's friend list and displays what friend the person is looking for. Also, you will have to make sure that as the user types that friend list keeps is constantly searched and shortened so the user can easily find the person they are looking for.

Create a Personalized web search Application based on user profile interests

I am created a personalized search web application .I will create a signup,login and user will fill in his interests based on that i have a doubt in search
I only want to use PHP and JAVA Script alone.
1)After redirecting to that specific search page from login, when i type a specific keyword in that,all i need is ,I need to display results in that domain/web application by fetching the results from search engines.the results should be web content articles,image,video,news.
My doubts is how can i get the feeds from search engine to get displayed in my application such that the keyword which is provoked to search in the search tab should refer to match the user interests which is stored in the database based on this,it should provide the results.
I hope you friends understood the problem statement of this application.
Please help me solve this problem and if any code/book related to this,please tell me.
This isn't a well written question so I'm not entirely sure what you're asking. I interpret the problem as this:
You want a website that registers users with specified interests
You want those users to see tabulated results based on their interests (with the results being lifted from search engines).
The above being a correct interpretation, I would suggest you use something like the "curl" function, mentioned previously on Stackoverflow:
How to get Content ot Remote HTML page
In the above example, the URL specified would (in your case) contain the search engine string. Say you were searching for "bricks in china", then your url string that would be passed to the curl function, would be "https://www.google.co.zw/search?q=bricks+in+china&oq=bricks+in+china"
Another good example of tackling this problem (outside of the Stackoverflow community) is presented here: http://davidwalsh.name/curl-download
Hope that helps :)

Get Search Engines to link to sub-pages instead of index

I wrote a blogging system from scratch (http://seanhess.net). I have the last 10 posts displayed on the index page /, and each post has it's own page /post/a_simple_post. I'm getting a good rank in google when I search for specific info from my posts, but google links to the index page instead of the post page. How do I get the search engine to drill into those post links?
<div class="blog_post">
<div class="info">
<span class="tags">
Framework
PHP
Tutorial
</span>
<span class="date">August 03, 2009</span>
</div>
<div class="content">
<h1>Example Post</h1>
<p>Paragraph</p>
</div>
</div>
The search engines already do it, unless your robots.txt file specifies otherwise, or some special attributes in your <a> tag (which it seems you are not using).
I think the only problem you are having is that your index page ranks much better than your sub-pages. This might be because people link to your index page.
Google probably displays your home page because it thinks it is a relevant answer to the search the user did...
One way that would help making your "post" pages more important is to display the full-content of the post on the home page for only the last post ; and, for the next ones, only display some excerpt, or a summary, or something like that.
It would make your post pages more important... But that would also mean having a "less important" home page... Which may or may not be good.
Google also uses links from other websites : if many important sites link to your homepage, and only a few link to your post pages, google will think the home page is more important than those.
As your blog is about PHP, one nice thing could be to be syndicated on http://www.planet-php.net/ : it allows many people to see your blog entries -- and is nice for visibility too (both to users and to google, as it has a high pagerank, I suppose)
Still, google is probably already exploring your whole site : if there are links to your post pages (there are on the home page, at least), google will visit thoses one day or another...
One thing I just noticed, though : your first post was in june, and you've been active only for a something like a month and a half ; it is not that long, especially if not many websites have links to yours...
In the end, there is only one secret : the more you'll write interesting stuff, the more people will find your blog interesting, the more they'll talk about it and include links to it, the more google will see about it too, the higher you'll be in results, and so on ;-)
But, yes, it takes time... Especially if you want to only write interesting posts -- and you should not post crap just to have lots of content !
I just saw you have a first blog on http://code.seanhess.net/ and that you now have another one on http://seanhess.net/ ; do you think it would be wise (depends on your content, on what you want and all that !) to move all blog-posts from the first one to the new one, adding permanent redirections on the old pages to the new ones ?
You might also want to take a look at some articles on the net, as well as some questions/answers here on SO, that could give you some useful advices. For instance :
Is SEO knowledge important for web developers?
Using SEO-friendly links
What kind of SEO Technique need to apply for my website…
SEO URL Structure
and probably lots of others -- provided you know what you are searching for, you'll find lots of interesting "tips/techniques"
And if you search with... google for instance... you might find many interested articles on the net about that too...
It helps to have a descriptive title tag and meta description in each of the content pages. Google has a useful section and starter guide I refer to frequently on this topic: Google SEO site.
I recently finished this book on SEO which has a lot of useful tips on technique and online tools to help increase search rank: Kris Jones SEO book
What I've seen is the quickest way to move up in search rankings is to get pages linked to from other sites considered to be an authority on the topic the page is focused on.

how can google find me if I am inside a mysql table?

I am creating a classifieds website.
Im storing all ads in mysql database, in different tables.
Is it possible to find these ads somehow, from googles search engine?
Is it possible to create meta information about each ad so that google finds them?
How does major companies do this?
I have thought about auto-generating a html-page for each ad inserted, but 500thousand auto-generated html pages doesn't really sound that good of a solution!
Any thoughts and idéas?
UPDATE:
Here is my basic website so far:
(ALL PHP BASED)
I have a search engine which searches database for records.
After finding and displaying search results, you can click on a result ('ad') and then PHP fetches info from the database and displays it, simple!
In the 'put ad' section of my site, you can put your own ad into a mysql database.
I need to know how I should make google find ads in my website also, as I dont think google-crawler can search my database just because users can.
Please explain your answers more thoroughly so that I understand fully how this works!
Thank you
Google doesn't find database records. Google finds web pages. If you want your classifieds to be found then they'll need to be on a Web page of some kind. You can help this process by giving Google a site map/index of all your classifieds.
I suggest you take a look at Google Basics and Creating and submitting SitemapsPrint
. Basically the idea is to spoon feed Google every URL you want Google to find. So if your reference your classifieds this way:
http://www.mysite.com/classified?id=1234
then you create a list of every URL required to find every classified and yes this might be hundreds of thousands or even millions.
The above assumes a single classified per page. You can of course put 5, 10, 50 or 100 on a single page and then create a smaller set of URLs for Google to crawl.
Whatever you do however remember this: your sitemap should reflect how your site is used. Every URL Google finds (or you give it) will appear in the index. So don't give Google a URL that a user couldn't reach by using the site normally or that you don't want a user to use.
So while 50 classifieds per page might mean less requests from Google, if that's not how you want users to use your site (or a view you want to provide) then you'll have to do it some other way.
Just remember: Google indexes Web pages not data.
How would you normally access these classifieds? You're not just keeping them locked up in the database, are you?
Google sees your website like any other visitor would see your website. If you have a normal database-driven site, there's some unique URL for each classified where it it displayed. If there's a link to it somewhere, Google will find it.
If you want Google to index your site, you need to put all your pages on the web and link between them.
You do not have to auto-generate a static HTML page for everything, all pages can be dynamically created (JSP, ASP, PHP, what have you), but they need to be accessible for a web crawler.
Google can find you no matter where you try to hide. Even if you can somehow fit yourself into a mysql table. Because they're Google. :-D
Seriously, though, they use a bot to periodically spider your site so you mostly just need to make the data in your database available as web pages on your site, and make your site bot-friendly (use an appropriate robots.txt file, provide a search engine-friendly site map, etc.) You need to make sure they can find your site, so make sure it's linked to by other sites -- preferably sites with lots of traffic.
If your site only displays specific results in response to search terms you'll have a harder time. You may want to make full lists of the records available for people without search terms (paged appropriately if you have lots of data).
First Create a PHP file that pulls the index plus human readable reference for all records.
That is your main page broken out into categories (like in the case of Craigslist.com - by Country and State).
Then each category link feeds back to the php script the selected value regardless of level(s) finally reaching the ad itself.
So, If a category is selected which contains more categories (like states contain cities) Then display the next list of categories. Else display the list of ads for that city.
This will give Google.com a way to index a site (aka mysql db) dynamically with out creating static content for the millions (billions or trillions) of records involved.
This is Just an idea of how to get Google.com to index a database.

counting a Widget?

Hello I've recently added a weather widget for people to add to their site.
Is basically a php page that people can link to.
My question is can I somehow put a counter or something to count how many people are using my widget?
my widget is located here http://www.site.com/widget/ it's in farsi language.
Well, it depends - do you want to know how many people have used your widget in their web site, or how many people have watched web sites that use your widgets? These numbers are completely different.
For the later option, jonstjohn's method would work great: For easy implementation and lots of features I recommend the Google Analytics way - they have really fancy graphs that show a lot of interesting information.
If on the other hand you want to count how many web sites are using your widget then you can do as follows:
Create a table in your database with a varchar column. Put a unique index on that column.
In your code, read the $_SERVER["HTTP_REFERER"] parameter to get the URL that called your widget.
Now you want to strip just the domain part from that URL as a web site would probably put your widget in their template so it will be available in all of their pages. So if you want to count web sites and not pages in web sites, then do something like
$domainParts = explode("/", $_SERVER["HTTP_REFERER"]);
$domain = $domainParts[2];
Now insert the domain you found out into your table. If this web site has already called your widget once then the insert would fail with a unique constraint error - just ignore the error (for example by using "#" on your insert command, like #mysql_query("INSERT INTO...") ).
To know how many web sites are using your widget, simply count the number of rows in the table.
You can place tracking code on the PHP page. Possibilities are:
Google analytics code
Record each time the .php page executes by inserting a row in a database
I'm sure there are others, but those should work.

Categories