Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Giulio Pecorella

    (@giulio-pecorella)

    I see, is there any way to force a “pic MUST have both tags” situation?

    Thread Starter Giulio Pecorella

    (@giulio-pecorella)

    My bad, the theme that I was using had a “highlight search result” function that created this mess.

    Sorry!

    Thread Starter Giulio Pecorella

    (@giulio-pecorella)

    The keyword seems to be highlighted also if present inside the header.

    If I have a menu defined inside the header.php file and this menu cointains the “news” word, when I search “news test” I find the “news” string in the menu replaced with “news test”

    Thread Starter Giulio Pecorella

    (@giulio-pecorella)

    Thank you, this worked almost like a charm.

    Now when I search the writer I can get all of his books.

    I’m still having problems retrieving the author in the search results via “books related” keywords. Perhaps I should re-build the index?

    Thread Starter Giulio Pecorella

    (@giulio-pecorella)

    Sorry for the delay answering but I was trying to solve it on my own with no results.

    In CCTM, the “Relational” type of Custom Field allows you to create a One-To-One or One-To-Many relation between WordPress Posts.

    This is achieved by storing the related posts in the custom fields via the following syntax:

    [“1st_post_id”,”2nd_post_id”].

    Let’s say I have two custom post types: “Book” and “Writer”.

    I have a book post titled “The Big Story” that has a relational field called “book_writer” and a writer post called “John Doe” whose ID is 42.

    Since John Doe wrote “The Big Story”, I link the writer to the book via the “book_writer” field.

    The content of “book_writer” field will be [“42”].

    If I search “John Doe” I can get the “John Doe” post and any other post that mentions “John Doe” in its title or content but I can’t get the post “The Big Story” because the field hasn’t stored “John Doe” but [“42”].

    Due to naming standards of the project, I cannot add the writer of the book in the title of the book post.

    I edited the search.php file trying to do as follows:

    1) I get the “s” variable of the query to get the keywords and save them into a $new_keywords variable.

    2) If, in the results of the query, there’s a post whose post_type is “writer” I catch its ID and append it to the $new_keywords variable.

    3) I do a new WP_Query passing the $new_keywords variable as the “s” variable.

    Unfortunately the new WP_Query returns no results.

    Is there any other way to get the related posts in Relevanssi or am I getting wrong in the logic of my edit?

    Hope it’s more clear now and thank you

Viewing 5 replies - 1 through 5 (of 5 total)