Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
添加链接到一个php图像_Php_Css_Wordpress_Image_Hyperlink - Fatal编程技术网

添加链接到一个php图像

添加链接到一个php图像,php,css,wordpress,image,hyperlink,Php,Css,Wordpress,Image,Hyperlink,我的WordPress主题有一个带有全屏滚动图像的演示页面模板。我想为每个图像添加一个单独的链接。我该怎么做 <?php } else if ($presentation_type == 'image'){ ?> <div class="section" data-id="<?php echo $presentation_name; ?>" style="background-image: url(&l

我的WordPress主题有一个带有全屏滚动图像的演示页面模板。我想为每个图像添加一个单独的链接。我该怎么做

            <?php } else if ($presentation_type == 'image'){ ?>
                    <div class="section" data-id="<?php echo $presentation_name; ?>" style="background-image: url(<?php echo $presentation_image; ?>);" data-nav-color="<?php echo $presentation_style; ?>">


如果您在
HTML5中没有动态代码,则允许您简单地使用和
您还可以使用data-attribute并使用data-URL和JavaScript将URL添加到当前div中以打开链接,如下所示:

<div class="section" data-id="<?php echo $presentation_name; ?>" style="background-image: url(<?php echo $presentation_image; ?>);" data-nav-color="<?php echo $presentation_style; ?>" data-url="<?php echo $url; ?>">

您希望链接在哪里?包装滚动图像?
<div class="section" data-id="<?php echo $presentation_name; ?>" style="background-image: url(<?php echo $presentation_image; ?>);" data-nav-color="<?php echo $presentation_style; ?>" data-url="<?php echo $url; ?>">