简体   繁体   中英

Is there any solutions from replacing this code <?php get_template_part( 'template-parts/logo/logo' ); ?> to set a custom logo?

I am having problems with this code below:

<?php if ( $arts_menu_overlay_circle_contents === 'logo' ) : ?>


<?php get_template_part( 'template-parts/logo/logo' ); ?>

<?php endif; ?>

I want to set an custom logo but it automatically takes the logo.php part. I want it to get an image like.jpg or.png Anyone can help me? Thanks in advance!

If i understand you correctly and assume i know little wordpres (very little), i got this link https://developer.wordpress.org/reference/functions/get_template_part/ .

There is described how you will be rewriting the template file of the logo, which is php file.

So inside this template file you have to change maybe the path to your logo.

First of all you don't need to come to code this soon while using WordPress. All modern themes comes with Theme Options or customize option where you can place your logo. That's your first options. So try to find Theme Options Menu on your Dashboard. Otherwise go to Appearance > Customize and see the Header option to change the logo.

  1. get_template_part( 'template-parts/logo/logo' );

This refers to location template-parts -> logo -> logo.php inside your activated theme. So, appropreate solution will be create same folder and file in your child theme and change the code in logo.php to place your logo file directly.

Thanks All for supporting me. I have solved my problem by using a simple markup instead of php code that wordpress use. The code markup is:

<img src="https://placehold.it/200x200" width="200" height="200" alt="" />

Thanks Again all of you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM