I’d like to set up a column in my pod called "meta_description". I’d then set up a WordPress Template for this pod and what I’d like to do is to include whatever is in the meta_description column to display in my WP template.
Is that possible?
Look into the precode field, you can define variables which you can then put into your template. E.g. I do this to do a custom title tag:
$slug = pods_url_variable('first'));
$pods = new Pod(‘product’, $slug);
$tempValue = $pods->get_field(‘name’);
$customTitle = "$tempValue blah blah blah";
The forum won’t let me put all the code in the correct place, so sorry if it doesn’t come out right (either it’s that or the fact that I just got back from watching a world cup match and have had too many beers!). Remember to declare the global variable in your template before outputting, e.g.:
global $customTitle; echo '<title>'.$customTitle.'</title>';
p.s. if you define the variable $pods when calling the record you can use that in the main template so you don’t need to do the extra steps that I did (the reason I had the extra step using the global variable is that I called multiple POD records to generate the title tag – I haven’t included that in this example)
You must be logged in to reply to this topic.