Dynamic status bar for WordPress using Advanced Custom Fields

I am currently working on developing an order tracking system using Wordpress, ACF, and a form plugin that is yet to be determined for the user interface.

While the back-end functionality is working smoothly, my focus now shifts towards creating a visual progress bar for users (Authors) to track the status of individual orders (posts).

Within my field groups, I have outlined 6 stages that need to be completed. In order to move on to the next stage, a specific option (radio button) must be selected to conditionally unlock the subsequent phase.

These defined stages are what I aim to visually display on the front end

For instance, when Order 123 is initially created as a new order, the first step would be triggered upon adding the necessary information in the back end (creating a New Post). Subsequently, completing step 2 (Edit post) would advance the progress bar to reflect the second stage, and so forth until the process is finished.

To clarify further, while editing a post will not automatically progress to the following stage, the act of editing marks a completion and triggers the opening of the next level or stage based on the set conditions (e.g., Step 3 or 3).

I am contemplating on converting word labels into numerical values such as Label=Step 1|Value=1 to facilitate this transition.

Various sliders, event trackers, and range plugins have been experimented with but they all require numeric values which cannot be directly linked to ACF fields. Is there a method to assign a text value from radio/select/checkbox as a number and represent it visually?

Alternatively, any recommendations for suitable plugins or scripts that can assist in achieving this goal?

Ideally, each step would be color-coded in a gradient fashion to indicate progression once the progress bar is successfully implemented.

Thank you for your assistance.

Answer №1

Utilize the power of PHP intval to convert a string into a numerical value, ensuring that your ACF data is always in a format that can be manipulated. Then, incorporate a <progress> bar (or any other type of progress indicator you prefer) utilizing the aforementioned ACF field. Since the number of steps will consistently be 6, you can confidently set the progress bar's maximum value to 6, as the returned ACF field will fall within the range of 1-6.

<label for="post_step">Post Step:</label>
<progress id="post_step" value="2" max="6"> 2 </progress>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Wrapping text around an image using two distinct Angular components

Can text wrap around an image in Angular even if they are in separate components? Or do the text and image have to be within the same component for this to work, regardless of whether the image is on the left or right side? https://i.stack.imgur.com/hdlxD ...

How can you stop text in a textarea from spilling over into the padding?

When I add padding to a textarea element and type more than four lines of content, the content overflows into the padding. Is there a way to prevent this? I have looked at the suggestions in this thread and this one (specifically for google-chrome), but t ...

Stopping halfway through a jQuery toggle width animation to close again

Perhaps the question may be a bit unclear, but allow me to provide an example. When repeatedly clicking the button that toggles the width, the div continues to animate long after the button press, which is not visually appealing. My desired outcome is for ...

What is the best way to display breadcrumb text on a new line within a pop up when the width exceeds without resorting to a scroll bar

Presently, my breadcrumb has a scrollable wrap with text overflowhttps://i.sstatic.net/dhllv.png I want to make the overflowed text continue on the next line. How can I achieve this? The CSS code I am using for the image attached is as follows: .breadcrumb ...

What is the best way to create a container filled with numerical figures?

If I have the number 445758, and I want each of these numbers to be displayed in their own box like this: https://i.sstatic.net/hBiA4.jpg Can you explain how to achieve this? ...

Firefox not responding to input select dropdown selection

When creating a jQuery submenu box in Firefox, I encountered an issue with the input select dropdown. While it functions properly in Google Chrome, the select box behaves erratically in Firefox. When attempting to choose an option from the select box, such ...

Using jQuery to create a seamless transition in font size as you scroll

Currently, I have a jQuery animation function in place to adjust the font size of the .header-wrap text when the document is scrolled beyond 50px. While this method does work, I am not completely satisfied with it as the transition is not very smooth. Idea ...

Display function not functioning properly following AJAX request

I'm working on a functionality where I want to initially hide a table when the page loads, and then display it with the results when a form is submitted using Ajax. The issue I'm facing is that the code refreshes the page and sets the table back ...

What is the best way to resize a div located below a dynamic div in order to occupy the available space?

My website has a dynamic div1 and a scrollable table inside div2. I need the div2 to take up the remaining height of the window, while ensuring all divs remain responsive. I've tried using JavaScript to calculate and adjust the heights on window loa ...

How can I ensure a DIV is shown on every sub-page?

Is there a way to dynamically display a <div id="chatbox"> in all subpages without needing to manually edit each one? For example, adding this code to the main index.html file and having it appear on /products/index.html. ...

Why is my Bootstrap row exceeding the page width when I resize it?

As a newcomer to Bootstrap, I have been following tutorials to learn more about it. Currently, I am attempting to recreate the layout of Google's homepage. However, I am facing challenges with the grid system's responsiveness. I have managed to ...

Add a border to the 'contenteditable' class in a Bootstrap table after it has been modified

Looking for help with JavaScript and jQuery! I have a script that creates an HTML table from a CSV file, using Bootstrap for styling. I want to add CSS or a border to a table cell after it has been edited, but my jQuery attempts haven't worked. Any su ...

What is causing the search_columns parameter to not function properly in the get_posts() function within Wordpress?

I am currently developing a plugin that involves searching post titles for specific keywords. After consulting the documentation provided for the get_posts() function, I discovered that I should be able to narrow down my search to only the post title by s ...

The layout of the divs becomes distorted when the window is resized

When adjusting the window size, all elements in the center become cramped and unresponsive. Even the navigation items in the header do not resize properly. Here is my Triangle.js file: import React from 'react' import { motion } from 'fram ...

Align the checkbox input in the center of a flexbox container

I am in the process of creating a side menu with filters, and I need to design a row that includes an input checkbox along with some accompanying text. However, I am facing an issue where the checkbox does not center properly within the flex container when ...

Insert this loop within the column-4 bootstrap grid structure

Hello friends, I'm struggling to format this WordPress loop into a col-4 Bootstrap layout. I can't seem to get it right. Can someone please assist me? My goal is to show each "bucket-top-row" div in a col-4 layout. <div class="container"> ...

Creating a dynamic word cloud in D3: Learn how to automatically adjust font sizes to prevent overflow and scale words to fit any screen size

I am currently utilizing Jason Davies' d3-cloud.js to create my word cloud, you can view it here 1. I'm encountering an issue where the words run out of space when the initial window size is too small. To address this, I have a function that cal ...

What is the best way to ensure my images are responsive to the varying device sizes when displayed on this website?

In my endeavor to design a 2-column layout using Bootstrap, I aim for each row to consist of two columns: One column will contain text, while the other will display images that complement the textual content. Below is the Bootstrap code snippet for the n ...

What is the best way to showcase the contents of an array of objects from JavaScript on an HTML page in a dynamic

Looking for guidance in Javascript as a beginner. For an assignment, I need to create two separate JS files and use them to display data dynamically on an HTML page. One JS file, named data.js, contains an array of objects representing a product catalog. T ...

Expanding a div to occupy 100% width within a Material UI TableBody

I am struggling to center a CircularProgress component inside a material UI TableBody. I have attempted the following code, but the CircularProgress is not displaying at the center as expected. (Please note that only relevant code has been included) const ...