S
S
seryj092016-01-31 20:12:42
WordPress
seryj09, 2016-01-31 20:12:42

Problems with the ACF plugin?

Guys tell me how to solve this problem. Created a custom field. The field type is a link to the page. How to make that in the template on the page this field was displayed with a link and with the name of the page itself?
Example - I created a Venue field. When I select Kiev in the admin panel, for example, the page should look like this
Location: Kiev
I.e. it should display a clickable link with the title of the page.
<a href="<?php the_field('location'); ?>"></a>- this method displays a link, but how to make it also display the name? Thank you all in advance.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexey Nikolaev, 2016-01-31
@Heian

Either create another field of text type, in which you will specify the title manually, or get the page object by its url.

N
Nick Murzin, 2016-01-31
@R0s0maxa

Create another field with the title of the page and output something like this:

<a href="<?php the_field('location'); ?>"><?php the_field('title');?></a>

N
Nikita Souvel, 2016-02-01
@Souvel1

It is better to create a field of type "Record object" or there is a function url_to_postid () wp-kama.ru/function/url_to_postid

I
Igor Vorotnev, 2016-02-03
@HeadOnFire

1. Use the Post Object field www.advancedcustomfields.com/resources/post-object and set it to show you the desired post type
2. Get your post object with get_field()
3. Use the required fields from your object

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question