On a WP-site I am using some div's with the class .exclude_from_search Therefore I would like these div's not to show up in the list of search-results. Is there any way to achieve this goal?
I found articles about excluding pages, categories, tags... But nothing about how to exclude classes.
The problem is basically that these div's contain always the same information. Something like "responsible: some name" If anybody searches for the word responsible, he will see all pages in the list of results. That is not helpfull.
I would suggest you to use a better search for that purpose. It is not possible to exclude an html element from wp search functionality per se.
The search looks for strings in your WP database. If a match is found, you see the result in your search results.
To get better control over your search results, and to implement a list of stop words and exclusions, you might want to try out the Relevanssi plugin.
It comes with an explanatory GUI and should provide you with needed functionalities.
https://wordpress.org/plugins/relevanssi/
Related
I've yet to find that 2sxc has facilities for entering, browsing, filtering and otherwise allowing keyword based filtering/sorting. If so, is there documentation about this, or sample code perhaps?
I'd think it might also be likely that one could use DNN's pretty good capabilities for tags and categories, and also razor queries would enable this, but I'd sure love to see some examples/guidance on best practices for doing so from within 2sxc.
This is very easy to do, but it's much more advanced that just tags / categories.
Basically you
Create a new ContentType for the related information - like Tag, Category or whatever. It can have more fields than just a title, as a category could also have an icon
Add some of that data
Go to the content type where you want to use it, create a "Entity / Content-Item" field
Then go to the field settings, give it the name of the related info that is allawed and if 1 or more items may be added (category is often just 1, Tags is often many)
that's it :)
I think I've found a start on this at:
http://2sxc.org/en/Docs-Manuals/Feature/feature/2685
and the demo at
http://2sxc.org/dnn-app-demos/en/Apps/FAQ-with-Categories
I'm working on have a property listing asp.NET website and the current search function is pretty crappy. I want to know if I can use the Google Custom Search API to extract the results but still present them in the same way there are now (comprehensive listing items with pricing, images, etc. Here's the current look: http://temporadaplus.com/Aluguel-Por-Temporada.aspx?pais=Brasil ). Each listing item is created via a .NET itemtype. SO basically all I need is to know how to go about using Google's much better results without altering anything visually.
I came across this question here but I am not sure its exactly what I;m looking for. Any ideas or comments are appreciated.
I'm looking for the way for the site's administrator / moderator to find / filter the list of nodes by some field custom value. Field value could be defined by radio / text / checkbox etc.
Default content listing proposes only few filters, it's not enough for sites with huge amount of custom nodes.
Use an EntityFieldQuery object, documented here:
http://api.drupal.org/api/drupal/includes--entity.inc/class/EntityFieldQuery/7
The documentation has no examples (ugh), but there's a thread here with some:
http://drupal.org/node/916776
EDIT: Ah, you're talking about administration and not actually writing a module to do it. If that's the case, use a view with exposed filters, like the other guy said. :)
Maybe it would help to use a view for it, where you set filters, so that you get the desired listing.
I had to test this, but I've just confirmed. Views in Drupal 7 can indeed filter across multiple content types w/ custom fields, and still have filters apply to those custom fields. They seem to treat the nodes w/o those custom fields as empty or null values.
So for instance, I have article and blog content types. Blog has images, article does not. I can sort or filter on the image field, even though article doesn't have it. It simply assumes the field is null or empty.
This however, may not solve your problem of having a large number of custom fields. If these are dynamic (i.e. they grow over time) you might be in trouble. If, however, they are set, and just a very large number, you could manage this.
So while there is no automatic add all fields, which I believe you mentioned in a previous post, you could feasibly search on a large variety of the fields. Even exposing fields that you don't necessarily display in the table, but can then search on. Or changing the fields you expose or display on a per page basis in the view. All from one view. And then you could export the view to bring it over to the other sites.
I was going to try and attach the exported view, but the export is rather large for inclusion in an answer, I think. Please let me know if you think I should still include it, or if you'd rather I can simply send it to you through a PM. Let me know!
EDIT: I decided to include a link to an export of the view. http://greggalante.com/sites/greggalante.com/files/cross_type_view.txt
http://drupal.org/project/search_api
i need to create a block View with a search box attach to the header in order to search nodes for one specific content type. I don't know how to achieve this, so i ask for your help. Something like the attached photo.
I'm not exactly sure here, but it sounds to me like you want to:
Create a view;
add a "filter" which limits the view to only your desired content type;
add an "argument," and then expose this argument, for either title, body, or one of your text fields.
Unfortunately:
This alone will not search the whole node. If most of your content is in body, this would probably be a good way to do it. But, for example, if for some reason you have a title like "Bicycles in Timbuktu" with a body that does not contain the word "Timbuktu" - were your users to search for Timbuktu, this item would not appear. That said, it's probably a rather rare case, and if you are simply aiming for happy users, and not rigorous perfection, this will likely be enough.
That said, Kniganapolke's suggestion of checking out Custom Search is excellent. The advice here is more applicable if you want to do this as you've designated and using the power you have with Views (and the other possibilities they offer), rather than a more dedicated-type module. If you don't have other specifications which require you to use Views, I'd guess that Custom Search will likely be the better solution.
Have you tried Custom Search module?
If anybody is interested, i have edited the header block view and load a custom_search_block inside it.
Thanks anyway
create a view with the content you want and then filter it by content. Expose the filter.
http://beeznest.wordpress.com/2011/11/01/create-a-view-to-search-on-content-title-in-7-steps-in-drupal-7/
I'd like to add a block to the user profile that shows them content listings in their groups based on tags that they have in their profile.
(ie: someone puts a bike up for sale, the user has listed "bike" on their wishlist, it should show up to get their attention)
Since these tags vary user-to-user, I'm not sure exactly how to set up the filter.
Going a little farther, can I sort them by the number of matching tags?
I've found that taxonomy terms and views can be very tricky to get right. The main problems is that taxonomy terms has a one to many relationship with nodes, and views is built to be generic.
It might be quicker to create such a block in a custom module instead, because you may very well get stuck in views before getting what you want. Also you most likely have to create your own sort plugin for views, to get the sorting you want. I haven't seen any module creating something like that, and I don't think it's possible with views core. Creating plugin for views can be very harry, the first time you do it, so unless you know your way around views, I think you will have more luck just creating a block yourself. It's much simpler, than having to extend the views functionality.
Have you looked into Views? You can set up a block with views that retrieves (almost) ANY information from the database.
In your case, you can filter the information that you need and that belongs to the current user, also, sorting is doable via the Views administration.