Support

Account

Home Forums General Issues Basic "Display Text" Not Working

Solved

Basic "Display Text" Not Working

  • Hello,

    I really don’t know how to explain this without making myself look stupid, but here it goes.

    I’m trying to do the very simple action of creating a field which will display text on the front end. So in short, I will type the text to be displayed on the page’s back end, and that text will be displayed in a header on the front end.

    I cannot get this to work after following two tutorials:

    1. A modern tutorial on Udemy that introduced me to your plugin (Lecture 33): https://www.udemy.com/create-custom-wordpress-themes-from-scratch/

    2. A somewhat outdated YouTube tutorial: https://www.youtube.com/watch?v=xtqMatzVoSA

    Upon following those two tutorials, I have tried this both in the development environment of my laptop. When that did not work, I made a WP on my cPanel account. Tested a large amount of different variations and could get nothing to work.

    I ran a var_dump each time and always got back bool(false). I don’t know if that is correct or if it is an error; I do not know what is causing it.

    Regardess, here is the exact step-by-step process I follow:

    1. Go to Add New Plugin.
    2. Install Advanced Custom Fields By Elliot Condon
    3. Activate.
    4. Go to “Custom Fields” option on the WP Admin Menu.
    5. Add New Field Group, Name it Home
    6. Add Field, label it Head
    7. I am assigned the name head
    8. For type, I select Text
    9. Nothing else is changed in the first section.
    10:

    Now this text will be going on the home page, which is given its own Template named “Custom Home Page”.

    For location rules, I set: Show this field group if: Page template is equal to Custom Home Page.

    11: Nothing else on that page is changed, Click Publish.
    12. Pages > Home
    13. Head is there! I enter the text: Example text goes here.
    14. Click Update
    15. Update successful.
    16. I then go to the Custom Home Page Template.
    17. Find a spot where I want to put my custom text
    18. Enter in <h1><?php the_field(‘head’); ?></h1>
    19. Save.
    20. Check my site and….. nothing. Nothing prints out, no PHP errors and error detect is on.

    Once again, I’ve tried this on two different WP instances on two different machines with two different configurations on each. I’ve also modified the ACF field configurations to handle different locations, different names, different everything and still to no avail, I get NOTHING.

    Any help with this would be MUCH appreciated.

    Thanks so very much!

  • Is you code inside or outside of the loop.

    This will only work inside the loop <h1><?php the_field('head'); ?></h1>

    If your code is not inside the loop the you need to supply the post ID <h1><?php the_field('head', $post->ID); ?></h1>

    That’s the only thing I can think might be the cause from your explanation.

    ~JH

  • Hi John,

    Thanks for your input but that didn’t really seem to solve the problem.

    I’ve re-installed the plugin for roughly the 5th time and re-created the field and now it is somehow working (with no loop or post ID involved).

    Very confused; but as long as its working, I suppose.

    Regardless, thanks for your help!

    Setting to solved.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Basic "Display Text" Not Working’ is closed to new replies.