Tagged: custom post types, group tabs creator pro
Hi Brajesh,
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?
Best regards
John
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.
‘
<?phpget_header();
the_post();// vars
$location = get_field(‘location’);
$thumbnail = get_field(‘thumbnail’);?>
<div class=”wrap”>
<div id=”event-hero”>
<?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>
</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>
<div id=”primary” class=”content-area”>
<main id=”main” class=”site-main” role=”main”>
<?php the_content(); ?>
</main>
</div></div>
<?php get_footer(); ?>
‘Hi John,
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.
Regards
BrajeshHi Brajesh,
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?
Best regards
John
Hi John,
In that case, the changes need to go to the dynamic group tab contents plugin.Please open core/bpdgtc-shortcode.php and look for line 84. You will find the relevant section for adding your code.
Regards
BrajeshHi Brajesh,
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.
Best regards
John
I think this plugin may be an easy solution?
Hi Brajesh,
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…
Best regards
John
Hi John,
Thank you for the reply.I am not sure which use case will help you but if adding custom field will help you, Please let me know and I will post an example.
Regards
BrajeshHi Brajesh,
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.
https://legally-linked.com/law_firm_technology/addleshaw-goddard-technology/
I have tried to add this as a specific tab to this group.
https://legally-linked.com/groups/addleshaw-goddard/
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.
https://legally-linked.com/groups/addleshaw-goddard/addleshaw-goddard-technology/
I am going around in circles trying to figure this out !!
Please help Brajesh 🙂
Best regards
John
You must be logged in to reply to this topic.