Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Im using a plugin called wp carousel to display custom post types in a carousel in the footer in the singular view of posts. By default the plugin gets the featured image and the title of the post, but i want to add a custom field (plain text) I've added to the custom post type through ACF.

I've tried adding this to plugins/wp-carousel/themes/default/theme-jcarousel.php

<?php global $post;
$sidans_id = $post->post_id;
$hamta_kund = get_field('kund');
echo $hamta_kund;
?>

on line 192 (right after the code that gets the title.

What this does is get the currently viewed posts' custom field, I want to get the custom field that is associated with each post in the carousel. So every item in the carousel gets the same value (the value from the one im currently viewing).

Do anyone know what im doing wrong?

This is some documentation from the plugin-author. http://sumolari.com/proyecto/wp-carousel/wp-carousel-documentacion-docs/

I've tried the support forum but no answer and im running out of time with the client.

share|improve this question
add comment

1 Answer

You should use get_post_meta($sidans_id, 'kund', true); instead. The get_field call is using the ID from the post loop and not from global.

share|improve this answer
    
Thank you for pointing that out, for page-id I had to use $item['ID'] to get the current Id from the plugin. –  talven Jun 12 '13 at 13:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.