Home › Forums › General Issues › Add a page url to a rotating homepage banner
Hi
I have a rotating banner on the home page and I want to make it clickable, so if a visitor clicks on it, it sends them to another page in the site.
I am using the Total theme so each of the banner images has been created by pulling through the featured image of a page.
I’ve created a new field for the page template and added the generated php code to the theme’s functions.php file, but I just can’t get it to work.
Do I need to add some other code to the page template file?
I am a bit of a newbie at this, so any help will be really appreciated.
This is the code I added to the functions.php:
if(function_exists(“register_field_group”))
{
register_field_group(array (
‘id’ => ‘acf_external-link-key’,
‘title’ => ‘External link key’,
‘fields’ => array (
array (
‘key’ => ‘field_588249abf27dd’,
‘label’ => ‘External link key’,
‘name’ => ‘external_link_key’,
‘type’ => ‘page_link’,
‘post_type’ => array (
0 => ‘all’,
),
‘allow_null’ => 0,
‘multiple’ => 0,
),
),
‘location’ => array (
array (
array (
‘param’ => ‘page_template’,
‘operator’ => ‘==’,
‘value’ => ‘default’,
‘order_no’ => 0,
‘group_no’ => 0,
),
),
),
‘options’ => array (
‘position’ => ‘normal’,
‘layout’ => ‘no_box’,
‘hide_on_screen’ => array (
),
),
‘menu_order’ => 0,
));
}
If the rotating banner is something that is included in the theme you’re using then you’re going to need to talk to the theme author to get information on how to modify it to add what you want, or if the banner is done using a plugin then you need to talk to the plugin author. Once you how to add it their then the documentation here will help you with getting the values to add.
I contacted the theme author and all they said was: “Sorry, it is not possible. It requires change in code.” I’d hoped the advanced custom fields was a workaround, rather than fiddling with code, as I don’t know even where to start!
ACF is a plugin that basically requires fiddling with code. You need to find the place in the theme to modify the code in order to add values in ACF fields to it. I can help you with getting the values and might even be able to help you with altering the code, within limits, but I can’t really help you to figure out where in the theme code the changes need to be made. That would take someone that is familiar with the theme code or spending time to figure it out.
Hi, I’m trying to receive the url or id of images, but only shows “Array,array,array”. I’m inserting this code on my page [acf field="{$repeater_name}_{$row}_{$sub_field_name}"], is that correct?
I’m not developer, so, sorry for any dumb question.
Other question, I have a theme with slider, the shortcode of slider, shows the image ID. Is it possible to insert the shortcode of each line, inside this shortcode? Thanks
ACF shortcode will not work with image fields that are set to return arrays. It will work with repeaters the way you’ve done it and if you set the image field to return the image URL then it might work.
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.