Mikko Saari
Forum Replies Created
-
Forum: Plugins
In reply to: [ActivityPub] Possible to prevent comment federation?I don’t have the reply feature enabled in the front-end, so I added a new comment. Looks like replying in thread works fine… I need to remember to reply in thread from the WP admin in the future then, it seems.
Forum: Plugins
In reply to: [Relevanssi Live Ajax Search] Divi Menu | Theme BuilderLooks like that menu search form doesn’t use the
get_search_form
filter hook to create the search form, so that function does nothing. You can ask the Divi support if there’s a filter hook that can be used to modify the HTML code of the search form. If there is, then this is easy to fix, but if there’s no such filter hook, then installing Live Ajax Search to that search form is very difficult.Forum: Plugins
In reply to: [Relevanssi - A Better Search] Problem with filters and RelevanssiWhen Relevanssi indexes the post object field, it doesn’t see the post object; it sees the post ID. You need to use the post ID to fetch the contents from the related post so that Relevanssi can index everything you want from the post. See https://www.relevanssi.com/knowledge-base/indexing-acf-relationship-content/.
Forum: Plugins
In reply to: [Relevanssi - A Better Search] Hiding page result based on user roleIt’s definitely not easy – the WordPress way is to check capabilities, not roles. It would probably be easiest if you could create a new specific capability for each role just for the sake of checking the role.
The WP_User object, for example, has methods for adding a role, removing a role and setting user roles, but no method for checking the user role. The only method is
get_role_caps()
, which returns all the capabilities the user has from their roles.In any case, this no longer has anything to do with Relevanssi. I recommend you ask a wider audience – try your luck on more general WP support forums, perhaps someone can give you a good method for checking user roles. I don’t know one – I’ve always used capabilities because that’s easy.
Forum: Plugins
In reply to: [Relevanssi - A Better Search] Problem with filters and RelevanssiRelevanssi doesn’t require using the main query. Using the main query is a good idea for performance reasons because otherwise you’ll end wasting the main query. It’s not mandatory, though. The easiest way to deal with it is to set the
relevanssi
query parameter totrue
: add$args['relevanssi'] = true;
before you run the WP_Query. Does that fix this?Forum: Plugins
In reply to: [Relevanssi - A Better Search] Hiding page result based on user roleIn normal WordPress use, you don’t check for roles, you check for capabilities. If you want to check if someone is at least an editor, you check
current_user_can( 'edit_others_posts' )
. So, something like this:add_filter( 'relevanssi_post_ok', 'rlv_member_check', 10, 2 );
function rlv_member_check( $post_ok, $post_id ) {
// An array of post IDs that only editors can access.
// This can be created manually like this or automatically, whatever is your criteria.
$editor_posts = array( 1, 2, 3, 4 );
$post = get_post( $post_id );
if ( in_array( $post_id, $editor_posts ) && ! current_user_can( 'edit_others_posts ' ) ) {
// Post is among the editor posts, and the user is not an editor.
$post_ok = false;
}
return $post_ok;
}Now, I don’t know Members affects this. If it just offers an easy way to extend the WordPress roles and capabilities system, you’d do it like this, but if it’s something else, then you need to replace
current_user_can()
with whatever works with Members. The Members support forums will help you with that.Forum: Plugins
In reply to: [ActivityPub] Version 5.4 broke publishing new posts(Oops, a duplicate post…)
- This reply was modified 3 weeks, 2 days ago by Mikko Saari.
Forum: Plugins
In reply to: [ActivityPub] Version 5.4 broke publishing new postsThanks! And yeah, working with the state transitions can be a pain ??
I think you need to ask Bricks support. What you’re doing is how it works with normal themes, but Bricks isn’t a normal theme.
Forum: Plugins
In reply to: [Relevanssi - A Better Search] Duplicate Search ResultDo you mean the duplicate result after “Load more”? I think that’s some problem with the “Load more” feature. I see it requests the page 2 with
posts_per_page
set to 3, so it shows the post #4 the second time. Theposts_per_page
should match what you’re showing on the first page to avoid the duplicate.Fixing that is Bricks stuff, and I can’t help with that, I don’t know how Bricks works.
Forum: Plugins
In reply to: [Relevanssi - A Better Search] Search gives the same products on 18 pagesIf you search with the Relevanssi admin search (Dashboard > Admin search), does that show you 12 products?
If the Relevanssi admin search shows the correct number of posts, the problem is likely with the pagination.
Forum: Plugins
In reply to: [Relevanssi - A Better Search] Title search questionYou reindexed everything? How does the post title look like in the Relevanssi debugger (Settings > Relevanssi > Debugging) now?
Forum: Plugins
In reply to: [Relevanssi - A Better Search] Title search questionAdd this to your theme functions.php:
add_filter( 'relevanssi_punctuation_filter', 'rlv_adjust_punctuation' );
function rlv_adjust_punctuation( $replacements ) {
$replacements['/'] = '';
return $replacements;
}Then reindex. That should help.
Forum: Plugins
In reply to: [Relevanssi - A Better Search] Dropdown StylingYes, I suppose so, unless you modify it a lot. But this is really outside my expertise. You’ll get better answer for this from people who are CSS experts. The question isn’t restricted to Relevanssi or even WordPress, so asking around elsewhere will get you better results.
Forum: Plugins
In reply to: [Relevanssi - A Better Search] Dropdown StylingActually, my first answer was wrong.
The main problem here is that the taxonomy list dropdown is an
option
tag, and pretty much the only things you can style are the colours. Usually when people do custom-styled dropdowns, theselect
andoption
tags need to be swapped with something else that can be styled. That’s a bit more complex, though, and is not really a Relevanssi support question but a general web dev question.