admin管理员组文章数量:1312743
I have edited Advanced Custom Fields before but never set anything up from scratch, always relied on developers. But I'm wanting to do a very specific thing and I was hoping I could do it by myself.
I just wanted to add a few fields in the usual Wordpress tags taxonomy, then have them appear on the frontend. I basically want to add related tags (I'm calling topics) on the tags page. So a field that I can input other tags and have them click to send them to those. I may add a couple other basic text fields, but I just want to get the fields to appear on the page. I'm using a theme that may have a ton of things that are confusing what normally is seen, so if it helps to copy and paste a chunk of code from it, I can.
I have so far created the Field Group "tag_details" and the Field "related_topics". I have the field appearing on the backend of Wordpress correctly, when creating/editing tags. But I can't get it to appear on the front end.
I've tried different things from directions found here: /
and: /
I've tried inputting code in various places in tags.php. But nothing ever happens. I don't know if I have to put it in a very specific place, or it should be part of the other code on the page so it won't work just copy and pasting what is being suggested on those pages. Obviously I'm replacing things with the correct field group and field. But nothing is appearing.
Again, my knowledge is limited. But I was hoping this very specific use of ACF would be something I could pull off. Just about everything else I'm doing came already with the premium theme I purchased. Thanks for any help, and I can provide more info if needed.
Code below.
<?php
/**
* The template for displaying Category archive pages
*
*/
?>
<?php
get_header();
$tagID = $wp_query->get_queried_object_id();
$archiveLayout = tnm_archive::bk_get_archive_option($tagID, 'bk_archive_content_layout');
$pagination = tnm_archive::bk_get_archive_option($tagID, 'bk_archive_pagination');
$sidebar = tnm_archive::bk_get_archive_option($tagID, 'bk_archive_sidebar_select');
$sidebarPos = tnm_archive::bk_get_archive_option($tagID, 'bk_archive_sidebar_position');
$sidebarSticky = tnm_archive::bk_get_archive_option($tagID, 'bk_archive_sidebar_sticky');
$moduleID = uniqid('tnm_posts_'.$archiveLayout.'-');
$posts_per_page = intval(get_query_var('posts_per_page'));
$customArgs = array(
'tag_id' => $tagID,
'post_type' => array( 'post' ),
'posts_per_page' => $posts_per_page,
'post_status' => 'publish',
'offset' => 0,
'orderby' => 'date',
);
tnm_core::bk_add_buff('query', $moduleID, 'args', $customArgs);
?>
<div class="site-content">
<?php echo tnm_archive::tnm_archive_header($tagID);?>
<?php if( ($archiveLayout == 'listing_list') ||
($archiveLayout == 'listing_list_alt_a') ||
($archiveLayout == 'listing_list_alt_b') ||
($archiveLayout == 'listing_list_alt_c') ||
($archiveLayout == 'listing_grid') ||
($archiveLayout == 'listing_grid_alt_a') ||
($archiveLayout == 'listing_grid_alt_b') ||
($archiveLayout == 'listing_grid_small')
) {?>
<div class="mnmd-block mnmd-block--fullwidth">
<div class="container">
<div class="row">
<div class="mnmd-main-col <?php if($sidebarPos == 'left') echo('has-left-sidebar');?>" role="main">
<div id="<?php echo esc_attr($moduleID);?>" class="mnmd-block">
<?php
if($pagination == 'ajax-loadmore') {
echo '<div class="js-ajax-load-post">';
}
?>
<?php echo tnm_archive::archive_main_col($archiveLayout, $moduleID, $pagination);?>
<?php echo tnm_archive::bk_pagination_render($pagination);?>
<?php
if($pagination == 'ajax-loadmore') {
echo '</div>';
}
?>
</div>
<!-- .mnmd-block -->
</div><!-- .mnmd-main-col -->
<div class="mnmd-sub-col mnmd-sub-col--right sidebar <?php if($sidebarSticky != 0) echo 'js-sticky-sidebar';?>" role="complementary">
<div class="theiaStickySidebar">
<?php
dynamic_sidebar( $sidebar );
?>
</div>
</div> <!-- .mnmd-sub-col -->
</div><!-- .row -->
</div><!-- .container -->
</div><!-- .mnmd-block -->
<?php } elseif(
($archiveLayout == 'listing_grid_no_sidebar') ||
($archiveLayout == 'listing_grid_small_no_sidebar') ||
($archiveLayout == 'listing_list_no_sidebar') ||
($archiveLayout == 'listing_list_alt_a_no_sidebar') ||
($archiveLayout == 'listing_list_alt_b_no_sidebar') ||
($archiveLayout == 'listing_list_alt_c_no_sidebar')
) {?>
<div id="<?php echo esc_attr($moduleID);?>" class="mnmd-block mnmd-block--fullwidth">
<?php
if( ($archiveLayout == 'listing_grid_no_sidebar') || ($archiveLayout == 'listing_grid_small_no_sidebar') ) {
echo '<div class="container">';
}else {
echo '<div class="container container--narrow">';
}
if($pagination == 'ajax-loadmore') {
echo '<div class="js-ajax-load-post">';
}
echo tnm_archive::archive_fullwidth($archiveLayout, $moduleID, $pagination);
echo tnm_archive::bk_pagination_render($pagination);
if($pagination == 'ajax-loadmore') {
echo '</div>';
}
echo '</div><!-- .container -->';
?>
</div><!-- .mnmd-block -->
<?php }?>
</div>
<?php get_footer(); ?>
本文标签: pluginsAdvanced Custom Fields displaying on tag pages
版权声明:本文标题:plugins - Advanced Custom Fields displaying on tag pages 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741909927a2404380.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论