thinkwired
Forum Replies Created
-
Forum: Plugins
In reply to: [Quick Page/Post Redirect Plugin] www. version of link not workingWordPress is not setup in a subfolder.
I am not using an redirect or caching plugins.Forum: Plugins
In reply to: [Contact Form 7] Checkbox styling is not workingI am aware that the styling of checkboxes is controlled by the browser. I don’t want the class there to style, I want it there as a hook for javascript.
My issue remains, I’d like to add a class to the checkbox itself instead of to the wrapper around it. Its strange that adding “class:bar” to a checkbox and an input would behave differently.
Im passing the searchdept value through a hidden field in the search form so, I guess I dont need that portion of the code anymore since the GET method works.
ugh, that was s dumb mistake. late night. thanks again.
Changing that condition to this worked
if ($_GET["searchdept"] == "true") {
Yup, If I remove this condition it works.
if (isset($wp_query->query_vars['searchdept'])) {
Strange. The variable is in the url with a value. Any ideas?
If I change
return $hits;
toecho 'test';
Test is displayed on the page so the function is running.
If I var_dump $hits, it displays the array but that array includes things other than posts with a parent of 32.
It seems as though this bit of code is not true
if (isset($wp_query->query_vars['searchdept'])) { $valid_posts = array(); foreach ($hits[0] as $hit) { if ($hit->post_parent == '32') $valid_posts[] = $hit; } echo '<h1>test</h1>'; }
I have no idea why.
You are adding this code to the function.php file correct?
I don’t seem to be able to make it work. I think the code is as you’ve explained. Ive updated with my own actual variables.
function themeslug_query_vars( $searchdept ) { $searchdept[] = 'custom_query_var'; return $searchdept; } add_filter( 'query_vars', 'themeslug_query_vars' , 10, 1 );
add_filter('relevanssi_hits_filter', 'rlv_post_parent', 10); function rlv_post_parent($hits) { global $wp_query; if (isset($wp_query->query_vars['searchdept'])) { $valid_posts = array(); foreach ($hits[0] as $hit) { if ($hit->post_parent == '32') $valid_posts[] = $hit; } $hits[0] = $valid_posts; } return $hits; }
The search url is as follows https://mysite.com/?s=search+term&searchdept=true
Any ideas?
if ($somevariable=='true') { display custom results where parent ID = 123 } else { display normal relevanssi results };
Forum: Plugins
In reply to: [Nested Pages] Menus being changed?After the latest update I get an error when trying to delete a page from the nested tree view.
The following error is displayed; Fatal error: Call to a member function getMenuItemID() on a non-object in /public_html/wp-content/plugins/wp-nested-pages/app/Entities/NavMenu/NavMenuSyncListing.php on line 67
Forum: Plugins
In reply to: [Relevanssi - A Better Search] Add read more link to the_excerpt?You win! Thank you.
I was fixated on the_excerpt and totally forgot I could call it manually. THANK YOU.
Forum: Plugins
In reply to: [Relevanssi - A Better Search] Manual page excerpt being ignored?Awesome.
Cheers.
I searched for a donate button on your site but didn’t see anything?
Forum: Plugins
In reply to: [Relevanssi - A Better Search] Add read more link to the_excerpt?I think it’s better that way anyway, as it gives you more freedom to place the link wherever you want
But, you dont have the freedom to place the link inside of the excerpt P element. So, you can place it anywhere on the page EXCEPT inside the excerpt itself, which is where it makes the most sense (this is why wordpress gives the option to do it).
I find the forced links quite annoying actually.
They are not forced — it is an option that wordpress gives you.
I understand that this is your baby and repsect your decision, I just want to make sure I clarify that you cannot place the read more link wherever you want inside of the search results template.
Forum: Plugins
In reply to: [Relevanssi - A Better Search] Manual page excerpt being ignored?OK, I know what is happening now…
The excerpt IS displayed for a page but ONLY IF that excerpt contains a search term.
It seems as though relevanssi defaults to display the content UNLESS the excerpt contains more relevant keywords.
The problem in my case is, my content field is empty. This is a problem because some custom templates such as forms or galleries do not utilize the content field.
It would be nice if relevanssi fell back to using the excerpt IF the content field is empty.
I understand that this is your plugin and you may not want to take the time to support what you might consider a fringe case but, if you were to do it, I dont see any harm to this kind of logic. It means that a result will always have an excerpt even if it has no content (if an excerpt is provided).
The reason I would personally push for this feature is that the_excerpt is actually a perfect solution for displaying search results (which is why you use it to begin with!).
If you arent interested in making this change to the code, is there a way to use the default wordpress excerpt and still include your search term bolding feature? Maybe that is the solution.