Я хочу вставить изображение в класс image2, как показано ниже в коде. Я пробовал много разных вещей, но я получаю "?" каждый раз.
Картинка загружается в тот же веб-отель, что и мой сайт.
файл каталога: /www/wp-content/themes/jonas/images/meg.jpg
Это файл index.php для моей темы wordpress.
Код размещен на http://www.vetlesen.no
<?php
get_header();
?>
<div class="intro-tekst">
<h1>HI, IM A DESIGN STUDENT FROM NORWAY</h1>
<h3>Scroll down for work:-)</h3>
<div class="image2">
<!-- I want to insert "meg.jpg" image here -->
</div>
</div>
<?php
if (have_posts()) :
while (have_posts()) : the_post(); ?>
<div class="wrap">
<article class="post">
<h2 class="overskrift"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php the_content(); ?>
</article>
</div>
<?php endwhile;
else :
echo "<p>No content found</p>";
endif;
get_footer();
?>
вы можете использовать функцию get_site_url
попробуйте это:
get_header();
?>
<div class="intro-tekst">
<h1>HI, IM A DESIGN STUDENT FROM NORWAY</h1>
<h3>Scroll down for work:-)</h3>
<div class="image2">
<img src="<?php echo get_site_url(); ?>/wp-content/themes/jonas/images/meg.jpg" />
</div>
</div>
<?php
if (have_posts()) :
while (have_posts()) : the_post(); ?>
<div class="wrap">
<article class="post">
<h2 class="overskrift"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php the_content(); ?>
</article>
</div>
<?php endwhile;
else :
echo "<p>No content found</p>";
endif;
get_footer();
?>
.intro-tekst img{ width:youwidth px; }