Site logo

Archived topic

Create shortcode with PHP to insert in header (Pods)

5 replies · Started by Marcus Lindblad on November 18, 2019

Viewing posts 1–6 of 6

Hey guys!

Trying to create a shortcode that I can use in my Header Element.
The code seems to work, because it gets the correct data from my PODS field that I'm trying to get with this code:

-Content removed because of security reasons-

The URL that get's outputted is correct. However I would like to have it outputted with an anchor tag below the header and not before the header content :D

I suppose I write something wrong in my shortcode, and I would appreciate if someone would point out where the fault is!

Thanks a lot for the greatest theme and support EVER!
/Marcus

Thanks Tom!
When I'm using the shortcode in the header I'm just getting out a "1" which I assume is the ID of the Pod. (Instead of the expected URL that I got with just pasting the PHP in raw via a hook)

I guess I need to learn a bit more about Pods... :D

Hi there,

you may want to look at the display() function in PODs as opposed to the field() function.

Jim True on there support is really good so maybe worth joining there slack channel:

https://slack.pods.io

I found a guy who helped me out with some code.

The issue was, when inserting the shortcode in the header, I displayed the header elements ID instead of the pod.

Thanks for your help guys!

Awesome - glad you found the solution.

This archived topic is closed to new replies.