Support

Account

Home Forums Backend Issues (wp-admin) Link related to button not applying

Solved

Link related to button not applying

  • Hello,

    For a short presentation : I’m new here and I’m overall new in the development world (currently in coop work and learning WordPress development).

    I have an issue with a business website using ACF PRO : the agency that designed the website seems to have used ACF to create custom fields for backoffice page editing, one of those being a “block” including a thumbnail field, a title field, a content field (text), a button field and a link field sorting every pages or posts existing on the website and linking the button to the selected page/post.

    Image of the 'custom block fields' - admin page editing
    Image of the selection in the link field

    My issue being : when I select a page/post and save the edit, it doesn’t work. In the inspect console it shows that the href is empty and the button thus redirects to the ongoing page.

    After selecting Contact Page and save changes : still no redirection

    I’ve tried looking into the theme files and the plugin files and I found the following code in “My_Theme > content-flexible.php” of the theme files. It seems to correspond to the block previously seen when editing the page in the admin backoffice and is indeed using ACF functions “get_sub_field” and “the_sub_field” :

    Corresponding code in content-flexible.php of the theme files

    If I replace <a href="<?php the_sub_field('lien'); ?>" with the direct url of the “Contact” page in the href, then the button does indeed redirects to the Contact page. But it’s obviously not what I want, as I don’t benefit from the field at all and it forces me to go in the theme files in order to simply edit the link… (+ all issues going with updates and so on).

    All I want is to fix the actions of selecting a page in the link field and actually applying it to the related button. But I’m so lost as to where to do so…

    I appreciate any help and I’m available on Discord (or others) to do a screen share if needed.

  • OKAY ! CANCEL !

    I let the topic here just for information, but my problem has been solved !

    It was just a bug in the Field Group.
    I’ve simply edit the field group and save without any change and it solved it : now the page I select is actually applied to the link of the button.

    So much time grabbing my head for this xD I’ll remember to always edit/save every single dependence now

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.