WordPress.org

Ready to get started?Download WordPress

Forums

List category posts
How can I add fields created with ACF (2 posts)

  1. fortes - illustration
    Member
    Posted 1 month ago #

    Hi!

    Your plugin is really great, love it already!

    I would like to display fields (repeated, text-fields and file-fields) created with Advanced Custom Fields in my post listings. I've created my own template and it works great except I couldn't figure out how to put the ACF fields in there.

    I tried this:
    [catlist name=ukraina content=yes template=materiell-list title_class=no_link customfield_name=Links,Link,URL customfield_value=links,materiell_link,url customfield_display=Links,Link,URL]

    but it didn't work.

    I used the attributes like this:

    • customfield_name : Field Label
    • customfield_value: Field Name
    • customfield_display: Field Label

    I guess I'm totally off here and I suspect you have a great solution for this... because the plugin hasn't failed me yet : )

    Please, help me out!

    https://wordpress.org/plugins/list-category-posts/

  2. fortes - illustration
    Member
    Posted 1 month ago #

    So it's still not solved...

    I've changed the shortcodes attributes to this:

    [catlist name=egypt content=yes template=materiell-list title_class=no_link customfield_display="links,materiell_link,url,files_materiell,file_description,materiell_file" customfield_display_name="no"]

    and in my custom template I have this:

    $lcp_display_output .= $this->get_custom_fields('links', $single->ID, 'div', 'materiell_list');
      $lcp_display_output .= $this->get_custom_fields('materiell_link', $single->ID, 'div', 'materiell_list');
      $lcp_display_output .= $this->get_custom_fields('url', $single->ID, 'div', 'materiell_list');
      $lcp_display_output .= $this->get_custom_fields('files_materiell', $single->ID, 'div', 'materiell_list');
      $lcp_display_output .= $this->get_custom_fields('file_description', $single->ID, 'div', 'materiell_list');
      $lcp_display_output .= $this->get_custom_fields('materiell_file', $single->ID, 'div', 'materiell_list');

    links is a custom field with the sub fields materiell_link and url
    files_materiell is a custom field with the sub fields file_description and materiell_file

    Now I get a value from the custom fields telling how many sub fields there are but I would like to get the sub fields content instead.

    Link to screen shot with post list
    Link to screenshot where you can see how the custom fields are displayed in the post

    The site is under construction and closed for visitors at the moment, so unfortunately I can't provide a link to the site in the forum.

    I hope someone can help me with this.

Reply

You must log in to post.

About this Plugin

About this Topic