samedi 3 octobre 2020

How to create unique ID for input checkboxes on each blog in layout?

Using WP, I have a grid layout for the blog posts. I don't know php well at all but managed to insert an input checkbox that appears on each blog in the layout as you can see here:

<article <?php ( $post_class_enabled ) ? post_class() : ''; ?>>
                    <?php do_action( "uagb_post_before_inner_wrap_{$attributes['post_type']}", get_the_ID(), $attributes ); ?>
                    <div class="uagb-post__inner-wrap">
                        <input type="checkbox" id="blogtogglebox"><label for="blogtogglebox" class="blogtoggle"><i class="fas fa-ellipsis-v"></i></label>
                        <?php $this->render_complete_box_link( $attributes ); ?>
                        <?php $this->render_image( $attributes ); ?>
                        <div class="uagb-post__text">
                            <?php $this->render_title( $attributes ); ?>
                            <?php $this->render_meta( $attributes ); ?>
                            <?php $this->render_excerpt( $attributes ); ?>
                            <?php $this->render_button( $attributes ); ?>
                        </div>
                    </div>
                    <?php do_action( "uagb_post_after_inner_wrap_{$attributes['post_type']}", get_the_ID(), $attributes ); ?>
                </article>

You can see how it came out by going to https://webux.dev/post-grid-hover-fx/ . The problem now is that I need a unique ID to be generated for the input on each blog post so I can style them. For instance, the first article in the grid should be , the second article in the grid should be and so on. As you can see in the php, I would also need the label to change accordingly in for="". I hope I've explained myself well enough. So how do I do this? By the way, I had to do this by directly editing the plugin for the grid layout, I know that's hardly ideal, so I was also wondering if there is a way I can just put this whole thing in the function page of my child theme...




Aucun commentaire:

Enregistrer un commentaire