davidnde
Forum Replies Created
-
@x000 Thank you, saved me a lot of time!
Forum: Plugins
In reply to: [Relevanssi - A Better Search] Snippets not created from Custom Fields?@ekajatik: The pasted code defines a filter (
add_filter('relevanssi_excerpt_content', 'my_relevanssi_excerpt_content', 10, 3)). WordPress is looking for filters in plugins and in the theme’s function.php.Forum: Plugins
In reply to: [Relevanssi - A Better Search] Snippets not created from Custom Fields?Yes, you should, sorry about that.
Hopefully its fine now…
http://pastebin.com/iARLM1yGForum: Plugins
In reply to: [Relevanssi - A Better Search] Snippets not created from Custom Fields?To face @chee Studio problem, I would rather recommend to set default values in my_relevanssi_excerpt_content(). Here we go with the last updated version:
http://pastebin.com/cczmZDayForum: Plugins
In reply to: [Relevanssi - A Better Search] Snippets not created from Custom Fields?Oh, right, The $ was missing. Here is the updated version: http://pastebin.com/w2VXadNd
You are very welcome to post the code into the knowledge base. If you don’t mind, link to http://continent7.com.
Forum: Plugins
In reply to: [Relevanssi - A Better Search] Snippets not created from Custom Fields?Super! I upgraded my plugin and it works perfectly fine. For those who like to use this brand new feature, here is the code.
Thank you, I see 2.9.1 already implemented it. Thank’s a lot!
closed…Forum: Plugins
In reply to: [Relevanssi - A Better Search] Snippets not created from Custom Fields?Nice!
Actully the code I posted did not restrict to this one post type (Or did you have to type the post-type anywhere?). Just fill$fieldswith any custom field you want to show up in relevanssi’s excerpt.This will work even though there is no single post-type that has all the custom fields.
BTW: Checking for post-types and only doing this
is_the_content_called_by_relevanssitrick for post-types that have custom fields increases speed a little bit…Forum: Plugins
In reply to: [Relevanssi - A Better Search] Snippets not created from Custom Fields?BTW: If you are storing arrays as meta-data, relevanssi’s indexing will not work:
http://wordpress.org/support/topic/plugin-relevanssi-a-better-search-bug-report-wrong-use-of-get_post_meta?replies=1Forum: Plugins
In reply to: [Relevanssi - A Better Search] Snippets not created from Custom Fields?Chee, you are right, my code only worked if values are arrays. Try this again:
http://pastebin.com/wdvPFQydI just changed
$content .= ' '. implode(' ', get_post_meta($post->ID, $field, TRUE));to
$field_value = get_post_meta($post->ID, $field, TRUE); $content .= ' '. ( is_array($field_value) ? implode(' ', $field_value) : $field_value );If you don’t get along with this:
What do you mean with “Articel”? Do you mean the wordpress core post-type post, or you custom post-type named Articel?If you follow the post linked above, you will notice this problem is different. The problem is, that each value of
$values = get_post_meta($post->ID, $field, false);can be of mixed type. At least people use arrays as values.So, what is the best way to serialize these values? I am not quiet sure. What types are actually stored as meta-data. Only strings and arrays?
At least a would like to see something like:$values = get_post_meta($post->ID, $field, false); foreach ($values as $value) { // Custom field values are simply tacked to the end of the post content $post->post_content .= ' ' . (is_array($value)? implode(' ', $value) : $value ); }Forum: Fixing WordPress
In reply to: Understanding get_post_meta & singleNow I get it. There can be several values stored for the same postid AND key. Thank you!
Forum: Fixing WordPress
In reply to: Understanding get_post_meta & singleDon’t get it. I store an php array with update_post_meta and I want to get an array back. Then I have to use TRUE, eventhoug
use FALSE for an array
…
What array is meant?Forum: Plugins
In reply to: [Relevanssi - A Better Search] Snippets not created from Custom Fields?Ah thank you moderator, it’s all gone. Never mind, I mist this rule (but why is there a code tag in this form???)
Here we go: http://pastebin.com/Zx5qx4kN
Forum: Fixing WordPress
In reply to: Bug-Report: Critical bug when input contains non-unicode charactersBy the way, I now protect userinput with http://stackoverflow.com/questions/1401317/remove-non-utf8-characters-from-string#3521396
But this should though be fixed…