Rajouter un lien dans du php
Bonjour tout le monde,
Je viens vers vous car j'ai un petit soucis, je n'y connais pas grand chose en php...
J'aide une amie qui à installé un thème WP, à le modifier.
J'essaye de modifier le fichiers php pour faire en sorte qu'un <li></li> soit un lien entier au rollover.
Voici le code Html en question :
Code:
1 2 3 4 5 6 7 8 9
| <li class="col4 item illustration-character-design motion motion-design-animation-cartoon isotope-item" style="overflow: hidden; position: absolute; left: 0px; top: 0px;">
<img src="http://herve-sidonie.fr/wp-content/uploads/V_amberlair.jpg" alt="Amberlair Hotel">
<div class="col4 item-info">
<h3 class="title"><a href="http://herve-sidonie.fr/portfolio/amberlair/">Amberlair Hotel</a></h3>
</div><div class="item-info-overlay" style="opacity: 0; display: block;"><h3 class="title"><a href="http://herve-sidonie.fr/portfolio/amberlair/">Amberlair Hotel</a></h3>
<div><h4 class="no_title"> Illustration, Motion, NEW</h4>
<p>Vidéo de présentation du concept d'Amberlair Hotel</p>
<a href="http://herve-sidonie.fr/portfolio/amberlair/" class="view">details</a>
<a title="Amberlair Hotel / Illustration, Motion, NEW" href="https://vimeo.com/108360260" class="preview" data-rel="prettyPhoto[pretty_photo_gallery]" rel="prettyPhoto[pretty_photo_gallery]">preview</a></div></div><!--END ITEM-INFO-OVERLAY--></li> |
le lien du site :
http://herve-sidonie.fr/
il s'agit du bloc projet récents.
Donc j'aimerai que le <li> entier soit cliquable et non pas certains éléments comme le titre ou preview... ou autre ...
En cherchant un peu il me semble avoir trouvé le bon morceau de PHP à modifié. Sauf que je ne sais pas comment le modifier ... j'ai bien essayé de rajouter des $html .... avant la balise <li> pour introduire un lien, mais je n'ai pas réussi ...
Donc pourriez-vous m'aider à modifier ce petit morceau de php pour rendre l'ensemble du <li> cliquable ? en supprimant les liens preview et details ?
Le code php :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
| $html .= '<div class="portfolio-grid">';
if ($shape != "") $html .= '<ul id="thumbs" class="shaped ' . $shape . '">';
else $html .= '<ul id="thumbs">';
$temp = $wp_query;
$wp_query = new WP_Query( $args );
// The Loop
while ( $wp_query->have_posts() ) : $wp_query->the_post();
$title = get_the_title();
$permalink = get_permalink();
$queried_post = get_post(get_the_ID());
$excerpt = $queried_post->post_excerpt;
$featured_image_array = wp_get_attachment_image_src( get_post_thumbnail_id(), 'single-post-thumbnail' ); //original size
$featured_image_array_large = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large' ); //thumb size
$featured_image_array_small = wp_get_attachment_image_src( get_post_thumbnail_id(), 'blog-square' ); //square size
$large_image = $featured_image_array[0];
if ($excerpt == "") $excerpt = bra_excerpt(20);
if ($shape != "" && $shape != "triangle")
{
$featured_image = $featured_image_array_small[0];
}
else
{
$featured_image = $featured_image_array_large[0];
}
$video_link = get_post_meta(get_the_ID(), BRANKIC_VAR_PREFIX."video_link", true);
$subtitle = get_post_meta(get_the_ID(), BRANKIC_VAR_PREFIX."subtitle", true);
// get the portfolio cats
$terms = get_the_terms( $post->ID, $taxonomy );
if ( $terms && ! is_wp_error( $terms ) ) :
$names = array();
$slugs = array();
foreach ( $terms as $term ) {
$names[] = $term->name;
$slugs[] = $term->slug;
}
$name_list = join( ", ", $names );
$slug_list = join( " ", $slugs );
endif;
if ($shape != "") $html .= '<li class="item ' . $slug_list . '" ><div class="item-container">';
else $html .= '<a href="' . $permalink . '"><li class="col' . $columns . ' item ' . $slug_list . $fixed_height . '" style="height:' . $height . '; overflow:hidden">';
if ($hover == "no" || $hover == "no_with_pop_up")
{
if ($video_link != "")
{
$large_image = $video_link;
}
else
{
$large_image = $featured_image;
}
if ($hover == "no_with_pop_up") $html .= '<a href="' . $large_image . '" data-rel="prettyPhoto[' . $slug_list . ']"><img src="' . $featured_image . '" alt="' . $title . '" /></a>';
if ($hover == "no") $html .= '<a href="' . $permalink . '"><img src="' . $featured_image . '" alt="' . $title . '" /></a>';
if ($shape != "")
{
$html .= '</div>';
$html .= '<div class="item-info-overlay"><div><h3 class="title"><a href="' . $permalink . '">' . $title . '</a></h3><h4 class="no_title"> ' . $name_list . '</h4>';
$html .= '<p>' . $excerpt . '</p>';
$html .= '<a href="' . $permalink . '" class="view">details</a>';
$html .= '<a title="' . $title . ' / ' . $name_list . '" href="' . $large_image . '" class="preview" data-rel="prettyPhoto[' . $slug_list_ . ']">preview</a>';
$html .= '</div></div><!--END ITEM-INFO-OVERLAY-->';
}
else
{
if ($hover == "no_with_pop_up") $html .= '<div class="col' . $columns . ' item-info"><h3 class="title"><a href="' . $large_image . '" data-rel="prettyPhoto[' . $slug_list . ']">' . $title . '</a></h3></div>';
if ($hover == "no") $html .= '<div class="col' . $columns . ' item-info"><h3 class="title"><a href="' . $permalink . '">' . $title . '</a></h3></div>';
}
}
else
{
$html .= '<img src="' . $featured_image . '" alt="' . $title . '" />';
if ($shape != "") $html .= '</div>';
else $html .= '<div class="col' . $columns . ' item-info"><h3 class="title"><a href="' . $permalink . '">' . $title . '</a></h3></div>';
if ($shape != "") $html .= '<div class="item-info-overlay"><div><h3 class="title"><a href="' . $permalink . '">' . $title . '</a></h3><h4 class="no_title"> ' . $name_list . '</h4>';
else $html .= '<div class="item-info-overlay"><div><h4 class="no_title"> ' . $name_list . '</h4>';
$html .= '<p>' . $excerpt . '</p>';
$html .= '<a href="' . $permalink . '" class="view">details</a>';
if ($video_link != "") $large_image = $video_link;
$slug_list_ = "pretty_photo_gallery";
$html .= '<a title="' . $title . ' / ' . $name_list . '" href="' . $large_image . '" class="preview" data-rel="prettyPhoto[' . $slug_list_ . ']">preview</a>';
$html .= '</div></div><!--END ITEM-INFO-OVERLAY-->';
}
$html .= '</li>';
endwhile;
$wp_query = $temp; //reset back to original query
// Reset Post Data
//wp_reset_postdata();
$html .= '</ul>';
$html .= '</div>';
return $html;
}
add_shortcode('bra_portfolio', 'Bra_portfolio'); |
Je vous remercie par avance !
Bonne journée et bonne semaine.