How to get custom logo with REST API instead of get_theme_mod();

Question

Normally I use this snippet to set the a custom logo inside my custom themes. I’m a noob with the theme settings API and settings API so I don’t have at the moment a theme options page. I’m developing a vue.js based theme and I want to get all the data using axios. Is there a REST endpoin I can use to get the logo or I need to register a custom route like I’m doing for the menù and other themes resources?

<a class="navbar-brand ml-auto" href="<?php bloginfo('url'); ?>">
      <?php $logo = wp_get_attachment_image_src( get_theme_mod('custom_logo'), 'full' ); ?>
      <?php if( $logo ): ?>
        <img src="<?php //echo $logo[0]; ?>" width="auto" height="75">
      <?php endif; ?>
      </a>
0
, sialfa 3 years 2020-04-06T08:51:00-05:00 0 Answers 102 views 0

Leave an answer

Browse
Browse