Tagged: display fields, flexible content
- This topic has 4 replies, 3 voices, and was last updated 4 years, 3 months ago by
guanyixi.
-
AuthorPosts
-
-
February 6, 2016 at 1:58 pm #5866
alexadarkMemberHi,
i’m totally new to piklist, until now i was using ACF, and i wanted to switch to a library.
i see lot of documentation to create the fields, but not how to display them in the frond end.
Specially the add more fields, and also to make something similar to the flexible content, this is mandatory for me, i have seen it is possible here : https://piklist.com/support/topic/flexible-content-2/
but how to display it ?
where can i find exemples of codes already built ? -
February 7, 2016 at 12:05 am #5868
SteveKeymaster@alexadark– Welcome to the Piklist community!
The reason we don’t document displaying fields, is because Piklist does everything the WordPress way, so you can use standard WordPress functions to retrieve your data. For example, you can use get_post_meta() to retrieve your Post meta field data.
To display that example of the Flexible Content field:
1. Pull the data with a standard WordPress function likeget_post_meta()
2. The data will be returned as an array.
3. Use a standard PHPforeachloop to loop through the data and display it.Does that make sense?
-
February 7, 2016 at 2:29 am #5871
alexadarkMemberyes, but it really would be nice to have examples anyway
it’s ok for simple fields
i still don’t know how to do for the flexible content thing
do i write several foreach, do it need conditionals, i’m still not a php ninja, and having examples often allow me to understand, then to practice and become better
if there where a premium version with clear examples and real step by step tutorials i would buy it immediately -
February 10, 2016 at 10:31 pm #5892
SteveKeymaster@alexadark– You are not the first one to ask for this. Hopefully over the next few weeks we can put together a tutorial on building flexible content fields.
-
October 18, 2017 at 4:30 pm #8416
guanyixiParticipantHere is a simple example:
a field under meta-boxes
piklist('field', array( 'type' => 'text' ,'field' => 'page_title' ,'label' => 'Page Title' ));Display in front end
<?php $page_title = get_post_meta( get_the_ID(), 'page_title', true ); echo $page_title; ?>
-
-
AuthorPosts
- You must be logged in to reply to this topic.