Custom field on top of the title

Posted in: Newspaper
Post count: 3

Hi,

I’ve created a field by Advanced Custom Fields and would like to use this value on top of the title in modules. I can change the date to the top but I need the custom field there. How can I do it?

Here you can see the problem:
https://drive.google.com/file/d/0B8T_TzC3P4KbbGxDeTdyOWQ5ZDA/edit?usp=sharing

Thanks

Post count: 9544

Basically drop in the field where you want it in the template, which it looks like you have located for the module3 post layout.

Here are docs for ACF, if you didn’t already look at them
http://www.advancedcustomfields.com/resources/displaying-custom-field-values-in-your-theme/

You can try using shortcode, as per the docs such as
[acf field="{$field_name}"]

or normal php method
<?php the_field('custom_title'); ?>

Not sure if that was what you were asking, but perhaps that helped 🙂

Post count: 3

Hi,

Thanks for reply.

I’ve tried it but is shown the content of the field of the post/page selected. In homepage is not shown any content. In a post taged “Igreja Matriz” in the custom field is shown “Igreja Matriz” everywhere.
I’m not expert in php but I think I need a function to get the content of the custom field of the post in the loop.

I’ve studied the other functions used in td_module_3 like “get_author” and I’ve tried to adjust but didn’t work.

Here is the screen https://drive.google.com/file/d/0B8T_TzC3P4KbX2s1YTJwSmZTNlU/edit?usp=sharing

Post count: 3

It’s solved.

I’ve tried again to adjust another function and I could to do.

I’ve adjusted the function “get_author” and I created a new function “get_cartola” in the td_module.php. Here is the code.


	 function get_cartola() {

            $buffy .= '<span>';
                $buffy .= the_field('cartola', $this->post) . '</a>' ;
            $buffy .= '</span>';
    }

Now I just call the function over the title in td_module_3 or td_module_4 or anywhere.

https://drive.google.com/file/d/0B8T_TzC3P4KbOXVnVjIyajFUNnM/edit?usp=sharing

Thanks.

Post count: 6600

Hi,
Glad you managed finally.
Thanks for sharing!

Viewing 5 posts - 1 through 5 (of 5 total)
The forum ‘Newspaper’ is closed to new topics and replies.