Hello 🙂
I’m working on a project where there are lots of informations divided into chapters.
I use WordPress pages and a menu on the left with all chapters and sub-chapters.
I would like to create a visual helper so users know where they stop reading the pages. I was thinking about a true/false field on each page/chapter : “I’ve finished to read this chapter”.
Edit: I forgot to say that the true/false button should be available in the front-end.
Now I’d like to “link” this field value to another field on the menu item level to add a specific class on the menu item : If true/false is true, then add a class on the menu item. In that way I’ll be able to change the opacity of all menu items that has been read (for example).
I guess I have to use the load_field
filter but I do not exactly know how… I would need the page ID as well I think.
These settings will be different for all users… so maybe it’s not possible to do it with ACF.
I someone has a hint it would be a great help!
Hello,
OK, I’ve thought of a new process 🙂
I’ve created a repeater field to store the pages that have been read.
On the frontend I use acf_form to display the repeater AND two custom inputs prefilled with the page title and the page id.
Now what I need to do is to increment the repeater with the values of the custom inputs…
Any idea how I can do that? with load_field
?
Here are 2 screenshots, profile view and frontend view
Ok I managed to do it 🙂
Using add_row
after the form submission, here is the code:
add_action('acf/save_post', 'fs_sequence_progress');
function fs_sequence_progress( $post_id ) {
if ( ! is_admin() ) {
$seq_title = get_the_title();
$seq_id = get_the_id();
$uid = get_current_user_id();
$row = array(
'page_title' => $seq_title,
'page_id' => $seq_id
);
add_row('pages_ok', $row, 'user_'.$uid);
}
}
The topic ‘Creation of a reading progress feature’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.