I am trying to use Advanced Custom Fields with Group Tabs content. I have added the fields to use on the content posts, but cannot add the values without accessing via PHP.
I think I need to access the custom post types of Group Tab Creator, but can’t find the post.php file on the server?
Have you any testing with Advanced Custom Fields? If not, can you let me know where I can add PHP code to the post types?
Further to this I mean display the chosen fields within the display content post.
Advanced custom fields suggest adding this sort of example code to the custom-post.php file.
$location = get_field(‘location’);
$thumbnail = get_field(‘thumbnail’);
<?php if( $location ): ?>
<div id=”event-map” class=”acf-map”>
<div class=”marker” data-lat=”<?php echo $location[‘lat’]; ?>” data-lng=”<?php echo $location[‘lng’]; ?>”></div>
<?php endif; ?>
<?php if( $thumbnail ): ?>
” alt=”<?php echo $thumbnail[‘alt’]; ?>” />
<?php endif; ?>
<h2><?php the_title(); ?></h2>
<h3><?php the_field(‘date’); ?> from <?php the_field(‘start_time’); ?> to <?php the_field(‘end_time’); ?></h3>
<h4><?php echo $location[‘address’]; ?></h4>
<div id=”primary” class=”content-area”>
<main id=”main” class=”site-main” role=”main”>
<?php the_content(); ?>
<?php get_footer(); ?>
Thank you for the questions.
As far as I understand, you do not need the custom fields for the group tab entry post type. You need it for some custom posts list you are trying to show in the tab.
My suggestion is to create a shortcode for the same(your custom post loop with all the custom data) and put that shortcode inside the group tab.
That will work.
Thank you for the quick response and updates. To clarify, I am not trying to display a custom post type via the group tab. I am posting via BuddyPress Dynamic Group Tab Content. And I am trying to display the fields in the tab content.
Do you still recommend the same as above?
Thank you so much for your help. I am trying to add the code as suggested, but it is throwing-up lots of issues. It would be easier just to reference a separate custom post from the dynamic content page.
i.e. instead of filling out the_content section show a different custom post
Hope that makes sense.
I think this plugin may be an easy solution?
Just looking through this, I think you were correct with your first solution to adding custom post types. I will simply add a specific tab to a specific group, one at a time, and this tab can then link directly to a custom post. Means there will be lots of custom tabs created, but not much more work than adding the same amount of dynamic content posts…
I have tried to get this working but hit a problem.
I have set-up custom post types and added some pages.
Please see example.
I have tried to add this as a specific tab to this group.
Tab is “Technology”.
It links directly to the page, but I cannot get the link to include the group header info. I have tried adding the link in the sub-nav URL, but that does not work as it then has this URL.
I am going around in circles trying to figure this out !!
Please help Brajesh 🙂
You must be logged in to reply to this topic.