Skip Navigation

[Resolved] Dynamic content into header template

This support ticket is created 5 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 22 replies, has 2 voices.

Last updated by SteveG9252 5 years ago.

Assisted by: Luo Yang.

Author
Posts
#1369739

You still did not provide the details, can you provide the problem page URL?

As I mentioned above, you can see it works in URL:
hidden link

Since there is field "test link 1" field setting in that page:
hidden link

For other page, for example:
hidden link

Since there isn't field "test link 1" field setting, so it is expected result to see you mentioned in screenshot:
https://toolset.com/wp-content/uploads/2019/10/1369707-ballot_link.png

The dynamic field value works only in posts/pages with the "test link 1" field setting.

Hope it is clear.

#1370005

Luo,

Problem URL: hidden link
Credentials: same as localhost test

Area of concern: Mega Menu - not showing link as expected
Please check my settings with the field for that field. ( Government / Sample Ballot ).

You have mad it perfectly clear that ToolSets custom fields works as expected in this instance - you have provided proof of this.

Yet, inexplicably this does not work for me.

Please login to admin and check to see if anything is amiss.

#1370035

Luo,

I think you have already stated that the behaviour of the Menu link will not work - since there is no field setting within menu - correct?

I am not questioning that hidden link - I know that works.

The Government / Sample Ballot cannot work since there is no field to bind to within Menu structure.

My confusion is that I thought you said that the Menu link DID work for you on the front end.

Apologies for my confusion - perhaps if you login - and verify for yourself - then I can close this ticket

#1370415

Hi Luo,

I've solved the issue - but it appears there is a bug with ToolSet and Custom Fields - at least, I think there is!

Firstly, I created a video explaining the "problem" and work-around solution.

Please check out the dropbox link ( same link as before ) ...

I'll recap ...

1) I created a test page - had the custom field showing / bound to the page after updating it.
2) Went into Elementor / edited it by adding Custom Field and it works
3) I then went in to the Megamenu / Jetmenu / Elementor and added it and it did not work
4) When I viewed the physical test page ( hidden link ) - I could see the Heading field and it had the URL. Also, staying on that page, when I hovered onto the Menu - and went to the Sample Ballot - again I see the URL - IT WORKS!! Right? Not so fast!
5) When I click the URL - I go back to the homepage - expected behavior.
6) BUT - if I hover over the Government megamenu - and go to Sample Ballot it does not show.

What's happening?
1) Going back to the physical home page, I see the URL there - but I have not updated it yet! Once I do ( as I have done ) - and go back to the homepage and hover over MegaMenu / Sample Ballot - it now works!
2) So ... Look at at the HomePage - go to the Government megamenu - hover over any other link ( the one above - Absentee Ballots for example ) - you'll need to change the link to the custom field first - you'll see no URL link ( again, currently you'll see a predefined link in there now - not the ToolSet custom field ).
3) In the b/end - find that page - edit via WordPress - update that page and it now works.

Bug?
I assumed that once I instruct the field group to show on all pages that it should work - it does not - not until I update that page.

Workaround
So I need to update every page - tedious. And, if I add another custom field - then I need to update every page again.

Lot's of verbiage - sorry - but this seems to be a tricky issue.

#1371209

Thanks for the details, as I mentioned above:
The dynamic field value works only in posts/pages with the "test link 1" field setting.

in your case, you can try my first answer:
https://toolset.com/forums/topic/dynamic-content-into-header-template/#post-1368403

I have setup a demo in your website:
1) Edit the "Primary" menu, under item "Sample Ballot", add a HTML widget, with below codes:

<a href="[types field='test-link-1' output='raw' item='3406'][/types]">My link text</a>

It will output the URL field "test-link-1" value from specific page 3406:
hidden link

2) Since you are using some other cache plugins, you will need to purge cache

Test it in front-end, I can see: in all pages/post, there is a menu item "My link text", links to: hidden link

And it is only a demo, you will need to customize the menu item according to your website settings using CSS codes.

More help:
https://toolset.com/documentation/user-guides/views-shortcodes/item-attribute/
Item Attribute

#1371373

Luo,

Thanks for this - guide me how I can determine specific page number "value from specific page 3406" - I just need to get a fix on how I can figure this out ...

#1371821

As the URL I mentioned above:
hidden link

There is a URL parameter "post", value is 3406, it is that page/post ID, you can use it in Types shortcode as "item" attribute's value, then Types shortcode will retrieve field value from page 3406.

See the document I mentioned above:
https://toolset.com/documentation/user-guides/views-shortcodes/item-attribute/
numeric ID points to the ID of the post from which you want to retrieve data. If the numeric ID does not match an existing post, the data from the current post will be returned.

#1374667

My issue is resolved now. Thank you!