Jump to content

Archived

This topic is now archived and is closed to further replies.

Mark & Phil

Advanced Custom Fields + DMS?

Recommended Posts

Mark & Phil

Has anyone had any luck adding ACF to pagelines boxes? The ACF author says the issue is because if you're trying to add ACF outside of the loop (Textbox Section, Mediabox Section, etc..) then ACF can't tell what post ID its suppose to load.

 

Would love to know if anyone has a work around. We did find one but it would literally mean adding to our functions.php for every instance of the field needed across every page - not a scalable solution.

 

Thanks!

Share this post


Link to post
Share on other sites
Danny

HI,

 

How are you using it ?

Can you explain please.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
Erwan

Hi Mark & Phil,

Weird assertion from ACF... 
It's actually quite simple to use ACF shortcodes & functions in DMS, inside the loop, or outside the loop (in a box or whatever).

Outside the loop, just retrieve via the relevant WordPress function the post ID and pass it to your ACF function; maybe my short "tutorials" here could help you:

ttp://forum.pagelines.com/topic/29585-custom-fields-display-with-dms/page-2.

If not, I am of course at your disposal for any help, if you provide more details as Danny requests.

 

Regards.

Share this post


Link to post
Share on other sites
Mark & Phil

Danny, we're trying to add via shortcode or php shortcode to any of the sections but doesn't work because it can't understand what the loop ID is because those sections don't have it. 

 

We figured out a workaround by creating our own section that calls ACF within a post loop. Kind of works for the time being but some things like the Repeater Field in ACF won't work for some unknown reason unless we code it into the section, not passed through as a var.

Share this post


Link to post
Share on other sites
Danny

Hi,

 

I don't have access to the Repeater Field. However, if I do the following:

 

1. Create a simple Text Area custom field, assign it to the Page Type.

2. Then go to my Sample Page (which has an ID of 2), fill out the text area custom field with the following: <h1>Hello World!</h1>

3. Then go to my OMFGWTFBBQ page (which has an ID of 6), fill out the text area custom field with the following: <h1>OMFGWTFBBQ PageLines!</h1>

4. Now go to the DMS Visual Editor and add a TextBox section to my Sample Page.

5. Enter the following shortcode [acf field="myfield" post_id="6"], this will display the <h1>OMFGWTFBBQ PageLines!</h1> on my Sample Page, even though the field has been set on the OMFGWTFBBQ page.

 

Does that make sense ? Can you not follow the same by adding the post_id to your shortcode ?


Please search our forums, before posting!

Share this post


Link to post
Share on other sites

  • Similar Content

    • flourishdesignstudio
      By flourishdesignstudio+
      Hi,
      I am using PL5 as well as Advanced Custom Fields (AFC) to help add meta data to individual posts on our blog. However, where I am getting stuck is how to display the meta data on the actual public post page (frontend). For example, if we have posts that have a subject matter of plants then there are custom fields that the client fills out such as "Scientific Name", "Region", etc. I have used ACF before to display this meta data onto the loops section as well as in Revolution Slider or Essential Grid. However, I am not sure if there is a way to have this metadata display on the actual post page. Can you point me in the right direction? I am using a child theme so I wasn't sure if that meant I had to edit the functions.php file or if there was some other workaround that you knew of.
      Thanks so much!
    • Aires
      By Aires
      I have been trying to get some of my past clients who’s sites I still manage to allow me to bring their sites over to DMS (so I can stop paying ET yearly just for updates). I ran into an issue when I realize that I used advanced custom fields with a page template to generate some custom areas.
       
      My questions is how do I incorporate the ACF into a template when DMS doesn’t use traditional WordPress templates. In other words how would I call the data to have it show if there is no page/post php to write to.
       
      Is there something hidden that I don’t see that I need to copy into my child theme?    
       
      ~Aires
×