Skip to:
Content
Pages
Categories
Search
Top
Bottom

Custom fields in topic posts

  • @newtech1

    Participant

    I am wanting custom fields to show up when a user posts a topic in the forum. I am using ACF because it is suppose to be compatible with bbpress. The support team tells me I must contact bbpress for my current issue.

    I have uses ACF plugin to create custom fields. On the backend the custom fields show up if a user posts a new topic in the backend. The custom fields do not show up if the user posts a new topic in the frontend. Even though the custom fields show up in the backend, when the user posts the topic, the custom fields do not show up in the frontend. (I know the following code is correct because the custom fields will show up on the page in the frontend.

    Here is the code for the custom fields to display on front end:

    echo ‘Anglers: ‘ .get_field( ‘anglers’ );
    echo ‘<br>Catch Date: ‘ .get_field( ‘date’ );
    echo ‘<br>Time of Day: ‘ .get_field( ‘time’ );

    Questions:
    A. What bbpress file do I enter this into so it will show up on the frontend of a topic?
    B. What bbpress file do I enter this into so it will show when a user posts a new topic on the frontend, not the backend?

Viewing 3 replies - 1 through 3 (of 3 total)
  • @newtech1

    Participant

    From what I can tell it looks like this is the file I need to edit:
    content-single-topic.php
    But when I put the following code, nothing show ups on the frontend.

    echo ‘Anglers: ‘ .get_field( ‘anglers’ );
    echo ‘<br>Catch Date: ‘ .get_field( ‘date’ );
    echo ‘<br>Time of Day: ‘ .get_field( ‘time’ );

    Is this for sure the file that needs to be edited to show custom fields on the frontend?
    If so, anybody have any idea of what code I should use? Again ACH says they do support other plugins so they will not help me out.

    @newtech1

    Participant

    I have added the following code into content-single-topic.php and the custom field does not show up in the topic contents on the front end.

    <div class=”acf-view acf-view–id–151 acf-view–object-id–{object-id}”>

    <!–$anglers$–>
    <div class=”acf-view__row acf-view__anglers”>
    <div class=”acf-view__label”>Anglers</div>
    <div class=”acf-view__field”>$anglers$</div>
    </div>
    <!–$anglers$–>
    </div>

    [acf_views view-id=”151″ name=”Anglers”]

    [acf_views view-id=”151″ object-id=”ANOTHER_POST_ID” name=”Anglers”]

    @newtech1

    Participant

    A. I am getting to a fix to custom fields showing up in frontend on forum topics.
    Here is a code that is working to an extent.

    <h2>Anglers: <?php the_field(‘anglers’) ; ?></h2>

    If I go to content-single-topic.php and I insert in either of these thre places it shows up in the frontend:

    <?php else : ?>
    <h2><?php the_field(‘anglers’) ; ?></h2>

    <?php bbp_topic_tag_list(); ?>
    <h2><?php the_field(‘anglers’) ; ?></h2>
    <?php bbp_single_topic_description(); ?>
    <h2><?php the_field(‘anglers’) ; ?></h2>
    <?php if ( bbp_show_lead_topic() ) : ?>
    <?php bbp_get_template_part( ‘content’, ‘single-topic-lead’ ); ?>
    <?php endif; ?>

    If I put the code after <?php bbp_get_template_part( ‘content’, ‘single-topic-lead’ ); ?> it does not show up.

    B. After reviewing this code in content-single-topic.php, It appears I need to enter my custom field code in the single-topic-lead’ file. The reason I know this is if I delete

    <?php bbp_get_template_part( ‘content’, ‘single-topic-lead’ ); ?>

    in content-single-topic.php I ‘break’ the topic post page. However, to verify that I need to enter my custom field code into content-single-topic-lead.php I deleted the file from the server. Much to my surprise the topic content still shows up on the topic page. How can that be. I have cleared cache on my browser, tried different browsers, different computers and get same results. Any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar