Lay Theme Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Search

    shortocdes on woocommerce product pages for ACF

    General Discussion
    2
    6
    48
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sofiapapa08 last edited by sofiapapa08

      Hi there,

      Hope you are doing well.

      I discover a really powerfull plugin, Advanced Custom Field (ACF), but I am struggling to make it work because needs either php code (in functions.php) or shortcodes to display the content in the front-end.
      I've chosen shortcodes because easier, but i am wondering where can I add them on product pages. It seems that there is only "text box" (see image below).

      product_short_code.png

      Can someone help me? Either with shortcodes on product pages or even where to add my php line in the functions.php file? Looking like this:

      <?php $icons = get_field( 'icons' ); ?>
      <?php if ( $icons ) : ?>
      <img src="<?php echo esc_url( $icons['url'] ); ?>" alt="<?php echo esc_attr( $icons['alt'] ); ?>" />
      <?php endif; ?>

      Thanks a lot, and have a nice day!
      Sofia

      1 Reply Last reply Reply Quote 0
      • arminunruh
        arminunruh Global Moderator last edited by

        oh really you can use shortcodes with acf, i didn't know!

        i need to code something differently for lay theme. some shortcodes don't work because they rely on the "content" filter

        https://developer.wordpress.org/reference/hooks/the_content/

        but lay theme doesn't pass through its content through that filter

        it might work if you're in the gridder and press +more → +shortcode and put the shortcode in there

        S 1 Reply Last reply Reply Quote 0
        • S
          sofiapapa08 @arminunruh last edited by

          Hi @arminunruh!

          Thanks for the answer
          Okay! On the gridder on my products pages, the +more → +shortcode does not appear unfortunately (on the other page it does appear), but i think as you said it is because of the content filter. But would be so great and easier if there was this button shortcode! Do you think you could announce it when you'll do that?
          Would be magic 🔮

          Thanks a lot again,
          Have a nice week
          Sofia

          1 Reply Last reply Reply Quote 0
          • arminunruh
            arminunruh Global Moderator last edited by

            hi sophia!

            ah yea the gridder doesn't exist on a product page

            i wrote this down mmh not sure when i will have time!

            S 1 Reply Last reply Reply Quote 0
            • S
              sofiapapa08 @arminunruh last edited by sofiapapa08

              @arminunruh
              Hii!
              thanks:)

              I ate a lot of tutorials and FINALLY managed to do something that worked.
              I put here the magic link with all the explanation (short and simple by the way), maybe it is useful for someone til you install the shortcode tool on product page 💜

              Have a nice day!

              https://wplake.org/blog/woocommerce-product-page-template-with-acf-fields/

              1 Reply Last reply Reply Quote 1
              • arminunruh
                arminunruh Global Moderator last edited by

                ooh very nice! congratulations!

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Post a link to where the problem is if possible, please <3
                I don't answer or check forum DMs, please just post on the forum.
                Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com

                Before you post:

                Use the Search Feature. Maybe there is already a solution to your issue.

                1. Update Lay Theme and all Lay Theme Addons
                2. Disable all Plugins
                3. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code ", click "Save Changes"
                4. When using a WordPress Cache plugin, disable it or clear your cache. Now see if your problem solved itself.
                Go here, see if your problem is listed here:
                Troubleshooting

                When you post:
                1. Post a link to where the problem is
                2. If the problem is difficult to explain, post screenshots / link to a video to explain it

                Thanks!

                Online Users

                M

                Recent Topics

                • Search as icon instead of text?

                • FILTER Categories showing all projects

                • H

                  Vimeo embed with autoplay and loop is really slow...help!

                • A

                  website not loading on iphone safari

                laytheme.com