How do I add images to custom theme

I need to add an extra, static image in the page header. Right after the logo.

My child theme directory structure in [magento project root]/app/design/frontend/My_Vendor/My_Theme/

  ├── Magento_Theme
  │   └── templates
  │       └── html
  │           └── header
  │               └── logo.phtml
  ├── media
  │   └── preview.png
  ├── registration.php
  ├── theme.xml
  └── web
      └── images
          ├── logo.png
          └── CUSTOM_TAGLINE.png

The CUSTOM_TAGLINE.png is missing in the static files, the rest works fine.

The symlinks to images are being generated in a static folder [magento project root]/pub/static/frontend/My_Vendor/My_Theme/my_language/images/. My custom logo.png appears there along with loader-1.gif which I assume comes from the parent theme. Unfortunately my custom image CUSTOM_TAGLINE.png is not there.

In my modified Magento_Theme/templates/html/header/logo.phtml I have the line echo $block->getViewFileUrl('images/CUSTOM_TAGLINE.png') that also works as expected, printing the path to the generated static folder.

What do I miss here? Do I need to declare the CUSTOM_TAGLINE.png somehow?


It worked! I don't know what I did that I haven't done before but the CUSTOM_TAGLINE.png symlink appeared along with few other files. If you have similar problems just make sure to cache:flush and grunt refresh (if you use grunt). I suspect that was one of those.

Similar questions

Magento2: How to get images inserted in custom theme's media folder?
I'm trying to get image which is inserted in /app/design/frontend/Mytheme/themename/media folder using following code but it's shows 404 not found. I have also apply cache clean & static content deploy command but still not working. I'm using below code in my phtml file:- So is it possible to get images of media folder in M2? Any suggestion sho...
Magento 2: How to add custom block after the add to cart [Custom Theme]
I want to add a block after add to cart but this code doesn´t work: What is the problem?? Thankss
Add require-js to child theme at theme level
I want to add bootstrap javascript to my child theme. I have created app/design/frontend/<Vendor>/<theme>/requirejs-config.js In that file I have placed: This doesn't seem to do anything. How do I add scripts properly in a child theme?
Why my css is loading from the base theme instead of custom theme on migrating the site?
I developed a site in magento on windows 7, and now my system has been updated and install an ubuntu 12.04 in it. Now when I am running my site in browser I got an issue that my css is not loaded from the path which is loaded before. Firstly my css path is like this sportation ...
Magento Theme Fall-back / Hierarchy in the light of custom theme and third-party extensions
I've been looking into how Theme Fall-back / Hierarchy works since CE 1.4 and I think I've fairly well understood it. Then I move a legacy theme (the names purple-mix and purple_theme following are exemplary) which had been put inside the legacy locations: Those files have now been moved into the more appropriate, namespaced and currenlty as best-p...
related products (related.phtml) collection showing all products in one custom theme and just one of products showing in the other theme
it is so weird and I used the template path hints and everything is reading from the default theme but one of the themes is working properly and one other is not in related.phtml has 1 product for one of the themes and has more than 8 products in the other theme I tried to remove the themes or rename theme but I found that the problem is not from p...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.