Support » Developing with WordPress » Problem 404 with linking theme files in WordPress when creating your own theme

  • Resolved nsog8sm43x

    (@nsog8sm43x)


    I create my own theme for WordPress. I have linked the photos as indicated in the official documentation, but I get an error. Pictures are in place.

    This is my code.

    <img src="<?php echo get_theme_file_uri( 'assets/images/kontakt.jpg' ); ?>" alt="" class="rounded contact__img">

    I used all possible combinations of the type:

    <?php echo get_parent_theme_file_uri( ‘assets/images/kontakt.jpg’ ); ?>
    <?php echo get_parent_theme_file_path( ‘assets/images/kontakt.jpg’ ); ?>
    <?php echo get_theme_file_uri( ‘assets/images/kontakt.jpg’ ); ?>
    <?php echo get_theme_file_path( ‘assets/images/kontakt.jpg’ ); ?>

    None of them work.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 16 through 20 (of 20 total)
  • I have given you the proper code. Please test it.

    Thank you for your commitment and willingness, but unfortunately it doesn’t work.

    Moderator Steve Stern

    (@sterndata)

    Support Team Volunteer

    >> unfortunately it doesn’t work.<< and you won’t tell me how, show me an example, or show an error message.

    I need to walk away from this. I’ll leave the topic open for anyone else to jump on.

    Joy

    (@joyously)

    When you look at the page that should have the image in it, is that page 404? or is it the image that is 404?
    If it is the page, then something else is wrong.
    If it is the image, use your browser to View Source of the page and copy the img tag that was output into this topic in a code tag, so we can see what is happening.

    When you look at the page that should have the image in it, is that page 404? or is it the image that is 404?
    If it is the page, then something else is wrong.
    If it is the image, use your browser to View Source of the page and copy the img tag that was output into this topic in a code tag, so we can see what is happening.

    I think it will be easier when I make a screen. In general, the 404 error is just for the image, not the entire page.

    Images

    Joy

    (@joyously)

    It might have been easier for you to capture a screenshot, but it is worthless for answering your question. You have to look into the source of the page to see what the URL for the image looks like (that’s the output of your code) so you can know what to change in the code. We can’t look at it ourselves (especially not with a screenshot), so you have to do it.
    The question cannot be answered without the details of the output.

Viewing 5 replies - 16 through 20 (of 20 total)
  • You must be logged in to reply to this topic.