I need to create a WordPress website from existing HTML (more specifically from an asp.net website), so I create a template and target the php page using:
<?php /* Template Name: students */ ?>
My question : How to insert an image in WordPress CMS\dashboard and how to retrieve its value (only the value of the image) . Here is a static example:
<div class="col-lg-6 img-grids mt-lg-0 mt-5 pl-lg-4"> <img src="<?php echo get_template_directory_uri().'/assets/images/p1.jpg'; ?>" alt="" class="img-fluid radius-image" /> <img src="<?php echo get_template_directory_uri().'/assets/images/p2.jpg'; ?>" alt="" class="img-fluid radius-image" /> <img src="<?php echo get_template_directory_uri().'/assets/images/p3.jpg'; ?>" alt="" class="img-fluid radius-image" /> </div>
But if the website is static, the above method will work, but I need to be able to manage the images from the backend. Changing dynamic images.
Idea 1:
<?php the_content(); ?>
Display an ugly gallery as is, not just the value of the image. Idea 2:
P粉9165538952024-04-03 09:21:30
To do this, you can first create a meta box that inserts the image into the page, and then insert the meta box value into your code. This way, every time the image in the page's meta box is changed, it will also change on the user side. General Example (WooCommerce Image Gallery)
My suggestion is to use the acf plugin, but you can also get it from this link.
You can also use this linkCreate a gallery
Of course you can encode all of this But I recommend using this plugin.