Closed jmaas-onoffice closed 2 years ago
@jmaas-onoffice , i want to clear a few issue :
@tang-hien-egs I'm not sure that I understand some of the points.
example 1: the first,i create a custom field as issue #220, then i add shortcode in page content at page "page_detail".
After, i create page "issue_225" and add shortcode in custom field at page "issue_225
"
i want clean : now the plugin will set page detail is "page_detail"(the page has shortcode at page content) or "issue_225"(the page has shortcode at custom field).
Oh, I think I understand now, thanks for the example!
It does not matter if the shortcode is in the page or in a custom field. It should detect both types and the detail page should be set to the one that was saved last.
So in your example, it would set the detail page to issue_225 because you saved that page last.
Does this help?
Oh, I think I understand now, thanks for the example!
It does not matter if the shortcode is in the page or in a custom field. It should detect both types and the detail page should be set to the one that was saved last.
So in your example, it would set the detail page to issue_225 because you saved that page last.
Does this help?
yes,i will update in PR !
@jmaas-onoffice I have some cases that need clarification. What will happens to them?
Page content blank and ACF content is detail shortcode
Page content have text but not onOffice shortcode and ACF content is detail shortcode
Page content and ACF content have 2 different onOffice shortcodes. Which will take precedence, or take both?
Same shortcode in both places
@LongTrong-exe I'm not sure I understand what the problem is. 😅
I assume for each case you have more than one option in mind and you don't know which one to choose. Can you tell me which options you are thinking of for each case?
On master, I tried case (1.), (2.) and the page content is empty. And I don't know if this is a bug or not?
@jmaas-onoffice Just to be sure, can you explain to me what the ACF plugin does? :sweat_smile:
Ah, I think I understand the problem!
So ACF is basically a form builder for WordPress. It gives you more control over what the users can put on the page. Maybe this video helps get a feeling for how it is used to build a page. So it let's you say what information can be on a page, then users can fill out that information, and you can use that information in the theme.
We are using ACF on all our websites, so we want it to work well with the plugin. Unfortunately, ACF stores the information in post meta fields instead of the post content, which breaks some things like WordPress's built-in shortcode detection. That's why we have to do some additional things to detect the shortcode in ACF.
I think the problem for testing is that you need to actually output the ACF content in your theme. So in this case, you have put the shortcode in an ACF field, but you probably do not have a theme that gets that data and uses it. That's why nothing happens. In a "real" case, the theme would have some code that sees that the shortcode is used and outputs it on the page.
All in all, what we can test for is that the detail page is recognized correctly. That means the correct page should be linke as "Detail view is in use on page ..." and the estate lists should link to the correct page.
I know this is a bit complicated, do you have more questions? :)
Oh, I understand
If you have any more questions, feel free to ask! :)
Current state
After I add a custom field as described in #220, I can correctly set the detail page using the shortcode in ACF instead of Gutenberg.![grafik](https://user-images.githubusercontent.com/90763364/165500546-04b0874c-87e4-4b8c-8f49-4db8fedfca05.png)
I then add a new page and set a shortcode for an estate list instead of the detail page shortcode.![grafik](https://user-images.githubusercontent.com/90763364/165500854-3ed5bade-aefe-4644-bec4-e6ce01e62aa2.png)
After saving, this page is now considered the new detail page:![grafik](https://user-images.githubusercontent.com/90763364/165500947-e6ec8f7f-9b2d-4648-8b65-c2d5d9bfce52.png)
The cause is probably that the code doesn't check the view parameter of the shortcode: https://github.com/onOfficeGmbH/oo-wp-plugin/pull/184/files#diff-36b0349987efd5fb1177605d12886ce9d5a493e28ed7459aa63a721d7bc9991fR48
Desired state
The plugin should only set the detail page if the shortocde is actually the detail view shortcode.