• Resolved drdavidc

    (@drdavidc)


    I saw in one answer that Yoast Duplicate Post works OK with mobile pages. However, when I clone a page with a mobile version, the clone comes up with a mobile version that is the same page as the original without a separate page showing in the pages list. I’ve set the “Duplicate children” option but it makes no difference. Is there a way of working that allows pages with mobile versions to be cloned and create a new mobile version at the same time? Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jose

    (@giuse)

    Hi @drdavidc

    after you duplicate the page, you can unlink the mobile version with the bulk action “Unlink mobile version”. See this screenshot: https://josemortellaro.com/wp-content/uploads/2021/03/specific-content-for-mobile-unlink-mobile-version.png

    Let’s suppose you have the page Sample Page that has its mobile version and you want to duplicate it. You should do the following:

    – Duplicate the page
    – Go to Pages
    – Select the new cloned page and the mobile page
    – Select the bulk action “Unlink mobile”
    – Click on “Apply”

    Honestly, I’m not sure if this will also unlink the connection between the original desktop page and the mobile version. If it does it, go to the original desktop page in the backend and assign again the mobile version in the field “Related mobile version”.

    Another solution is to set Yoast Duplicate Post in a way that it doesn’t duplicates also the meta data of the page. I’ve never used this plugin, but if you have this kind of options, exclude these two meta keys:

    eos_scfm_desktop_post_id
    eos_scfm_mobile_post_id

    They are responsible for the connection between desktop and mobile.
    If you have this issue, it means Yoast Duplicate Page duplicates also the meta above, if you can say to YDP to don’t do it, you will not have any more this problem.

    Let me know if it helps.

    Thread Starter drdavidc

    (@drdavidc)

    Thanks Jose for the quick and helpful response. I forgot to say in my original post what a useful plugin this is and it’s working well for me. So thanks for your hard work.

    Yoast Duplicate Post does allow metadata to be filtered with a comma separated list of exclusions, so your solution of setting the filter works nicely to allow a post with a mobile version to be copied without linking back incorrectly. This is a reliable way of working, but requires a new mobile version of the copied post to be created from the desktop copy. If I copy the mobile version as well, there’s no way I can see to link the two copies.

    If I remove the metadata filters and copy both parts of the original post, those copied parts link back to their originals. If I try to edit the link of either in their respective editing pages, it breaks the pairing of the original post and its mobile version. Your code must be chasing the old value of the link being updated to fix the other end of it – this is probably the right thing to do in more “normal” circumstances.

    Given what you said about those two metadata fields, I’ve managed to correct the links between copies of the desktop and mobile versions in the database using PhpMyAdmin. This isn’t practical in general use, but it was useful to understand how things work.

    What would be useful would be the means to select two separate posts and tie them together as a desktop/mobile pair. At the moment, a non-paired post has only the “Create Mobile Version” button in the Mobile Version panel on its editing page. The possibility also of pairing with an existing post would be useful and would provide a solution to copying desktop/mobile pairs (provided the metadata filter was used during the copy).

    Plugin Author Jose

    (@giuse)

    Hi @drdavidc

    you are welcome! Many thanks!

    Rather than using phpMyAdmin you could change the values of the custom fields directly in the single page.

    Look for the custom fields:
    eos_scfm_desktop_post_id
    eos_scfm_mobile_post_id

    If you don’t see the custom fields, check “Custom fields” on the screen options.

    The value of eos_scfm_desktop_post_id will be the related desktop page ID of a mobile version, and eos_scfm_mobile_post_id will be the related mobile page ID of a desktop version.

    Another way is to create a mobile page, and then replace it with another mobile page in the field “Related mobile version”. After you have replaced it, you can delete the first mobile page. The first one would be only to make appear the field “Related mobile page”.

    I agree that having the possibility to assign an existing page would be cleaner, I will take into account for future versions, but let me know if one of those two methods works for you.

    Thread Starter drdavidc

    (@drdavidc)

    Another quick and useful reply. Thanks Jose.

    I’m quite new to WordPress so I didn’t know about editing custom fields. Your suggestion works nicely but care is needed. So, the following method of copying a desktop/mobile pair does work:

    1. Clone the desktop page and note the new post number by pointing at the Edit link of the clone
    2. Clone its mobile page and note the new post number by pointing at the Edit link of the cloned mobile page
    3. Edit the desktop page and update eos_scfm_mobile_post_id to the value of the cloned mobile page. Use the update button for the custom field but do not publish or save the draft. Return to the pages list without saving.
    4. Edit the mobile page and update eos_scfm_desktop_post_id to the value of the cloned desktop page and eos_scfm_mobile_post_id to the value of the cloned mobile page (i.e. the one you’re editing). Use the update button for the custom fields but do not publish or save the draft. Return to the pages list without saving.

    If you publish or save the draft before returning to the pages list, your code seems to detect the change of the custom fields and chases the old links to “fix” their target, which then breaks the originals.

    To copy just the desktop version, clone it as before and edit it to delete eos_scfm_mobile_post_id, returning to the pages list without saving it.

    The key thing is not to allow your link chasing code to execute and break the original(s).

    Hope that makes sense.

    Plugin Author Jose

    (@giuse)

    Thank you very much @drdavidc ! Sorry for my late answer.

    Yes, it makes sense and I’m sure it can help other users having the same issue.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Issues using Yoast Duplicate Post’ is closed to new replies.