• Resolved louisebaker

    (@louisebaker)


    I have interesting in using the custom fields. I’m relatively new to WP in general, and not up to speed on all things.

    I followed along your directions in the Other Notes. I have added the code you posted into the timeline-express.php. Those custom fields appear and I can type in them. However, I can not figure out how I am supposed to make the custom fields display using the get_post_meta. Where do I alter the code? How? Sorry if this is easy, but I googled quite a bit, searched all support threads here and on your site and couldn’t figure it out.

    Thanks,

    https://ww.wp.xz.cn/plugins/timeline-express/

Viewing 1 replies (of 1 total)
  • Plugin Author Evan Herman

    (@eherman24)

    Hi louisebaker,

    This is a bit outside the scope of the plugin, but if you wanted to add additional fields to the front end of your site, you’ll need to edit the single announcement template. Ideally, you would copy over the announcement template from with in the plugin to the root of your directory. From there you can make alterations.

    Better yet, it may be best to create a new template altogether so you have full control. You’ll see in the plugin itself we’re filtering the content using a custom filter (which may not actually be the best route, and something we should look into in future iterations of the plugin).

    https://github.com/EvanHerman/Timeline-Express/blob/master/classes/class.timeline-express.php#L820-L853

    You can see there the get_post_meta calls we have going on. Additionally, to create a single announcement template from scratch, you’ll need to create a directory ‘timeline-express’ in the root of your theme, and add a file to that directory with the name ‘single-timeline-express-announcement.php’.

    So the structure is:

    wp-content/themes/your-theme/timeline-express/single-timeline-express-announcement.php

    You can probably copy over one of your existing page templates to save you time – ideally single.php to mimic your existing single post structure.

    From there you can add the get_post_meta() calls wherever you need.

    The data for the timeline are stored in the pots meta table under the names:

    announcement_image
    announcement_date

    and the content is standard the_content() or get_the_content().

    For your custom fields, the meta key names will be different, depending on what you named them with the custom code for those fields.

    The Codex should help you out with most of what you need.

    Thanks,
    Evan

Viewing 1 replies (of 1 total)

The topic ‘How to use Custom Fields?’ is closed to new replies.