Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. General Discussion
  3. shortocdes on woocommerce product pages for ACF

shortocdes on woocommerce product pages for ACF

Scheduled Pinned Locked Moved General Discussion
6 Posts 2 Posters 265 Views
  • 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 Offline
    S Offline
    sofiapapa08
    wrote on last edited by sofiapapa08
    #1

    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
    0
    • arminunruhA Offline
      arminunruhA Offline
      arminunruh
      Global Moderator
      wrote on last edited by
      #2

      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
      0
      • arminunruhA arminunruh

        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 Offline
        S Offline
        sofiapapa08
        wrote on last edited by
        #3

        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
        0
        • arminunruhA Offline
          arminunruhA Offline
          arminunruh
          Global Moderator
          wrote on last edited by
          #4

          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
          0
          • arminunruhA arminunruh

            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 Offline
            S Offline
            sofiapapa08
            wrote on last edited by sofiapapa08
            #5

            @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
            1
            • arminunruhA Offline
              arminunruhA Offline
              arminunruh
              Global Moderator
              wrote on last edited by
              #6

              ooh very nice! congratulations!

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              I also code custom websites or custom Lay features.
              šŸ’æ Email me here: šŸ’æ
              info@laytheme.com

              Before you post:
              1. When using a WordPress Cache plugin, disable it or clear your cache.
              2. Update Lay Theme and all Lay Theme Addons
              3. Disable all Plugins
              4. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"

              This often solves issues you might run into

              When you post:
              1. Post a link to where the problem is
              2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
              3. If the problem is difficult to explain, post screenshots / link to a video to explain it
              Online Users
              Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
              laytheme.com
              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Recent
              • Tags
              • Popular
              • Users
              • Search