Performing wordpress search from a plugin - php

What's the correct way of performing an article search from within a Wordpress plugin? I want to perform the search and get a list of matching posts and pages back. That is I want the list back in the plugin code for further processing. I keep thinking there should be a function I can call, but I can't find it.

I have not worked with this plugin and I'm not entirely sure whether it serves search results in the way you need, but I think it does. Take a look at Wordpress Search API plugin.

Related

Search on a specific page for wordpress

Right now the search bar only searches for posts and such.
I have created a plugin and a subtheme/page for my site which displays data from this plugin. Basically it's persons and I want to be able to search for them both with name and description.
I have no idea where to start, can I change the current search bar's algorithm or do I have to change it completely?
I saw some plugins but I am unsure which one to choose, the easiest would be to make the entire site searchable but I guess that could make the results a bit too much as well I think.

Implement Custom Search Plugin for Joomla

I would like to implement a Custom Search Plugin for Joomla 3.5.1. I am new to Joomla and still busy getting my feet together.
I recently implemented a plugin that adds custom/extra fields (5 fields, free text inputs) to an article in Joomla 3.5.1. I followed their tutorial on how to get this right and so far so good. This plugin saves the extra/custom fields in the #__user_profiles table as per their tutorial. I could obviously save it to a different table but since I am learning, I kept it simple. This plugin works perfectly and I can capture the extra fields and saves successfully and the data is saved along with the article id being edited/created.
My next task is to create another site/front-end "search" (or smart search) plugin. This plugin must group the 4 field's values and provide them to the user in the front-end as selects/dropdowns.
Is there someone that can give me a lead on how I can archive this. Must I implement it as a search or smart search plugin? Is it even possible to archive what I am trying to archive?
This search plugin will only appear on one page but that I know I can config correctly once I've a plugin. Once user searches, the system must post back the selected options and I will search the "#__user_profiles" for any matching profile_key vs profile_value and collect all user_id (article_id) and get these articles from contents table and return this list of articles to the front-end as search results. Anyone can help me into the right direction?
I tried their tutorial of creating a search plugin but I seem lost, mostly I don't know how to dynamically provide my selects/dropdowns with that info saved in the #__user_profiles table.
Please assist in anyway possible...
I don't think that this might be done without modifying core 'search' task. My advise is to advise search view and include extra filtering, then write own 'search' task which allow you to read this data and provide additional results.
By writing just search plugin you can only extend search results by data which is stored outside default Joomla! tables but nothing more.

How to loop through admin pages in wordpress?

I am at a loss which method to use. I am simply trying to loop through all the admin pages in the backend of WP. From there I'll check if there's matching meta criteria and then return the results to a custom backend page. But I've searched and can't seem to find any sort of method or other to query it. Appreciate any pointers!
Following on from my comment,
Have you tried iterating through $GLOBALS['menu']

Can the Wordpress pagination functions be used for other objects (like WP_Users)?

Im building a page which will display a list of users based on provided criteria. My plan is the build a form and then use the submitted values to do a get_users() and then show the list.
I also want to be able to paginate the returned list because in some case the results might be quite long (300+). My experience with normal post/page pagination in Wordpress is that it's a bit finicky. And I have no idea how to attempt it with users.
Is this possible? Thanks in advance!
If you can use a plugin, you can use WordPress Users. In case you want to do it yourself, you have to come with a more specific problem.

Moving data from custom blog to Wordpress?

Ok so i have this custom blog that i now need to move over to wordpress. I tried using the import features in wordpress but that didnt work as planned. The custom blog is written in php and has a userscomments table, authors table, and posts table. Is there an easy way to move all these posts over to wordpress and preserve all the comments per post.
If the custom blog doesn't have an export function that will dump its data into a format WordPress can read, then it may be that you'll have to roll your own. There are 2 approaches:
Do a database-only import, using code or SQL tools along with information from the WordPress Codex entry on the WP database. This will probably be fairly simple from a coding standpoint, but you have to make sure you get it right.
Use the WordPress API to create the posts based on the output from the old system. This will involve a bit more learning, but it's the Right Way™ to do it, and means that you learn the WordPress API rather than the database structure.
If I were doing it myself, I'd choose option #2.

Categories