简体   繁体   English

替换此代码是否有任何解决方案<!--?php get_template_part( 'template-parts/logo/logo' ); ?-->设置自定义标志?

[英]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.我想设置一个自定义徽标,但它会自动使用 logo.php 部分。 I want it to get an image like.jpg or.png Anyone can help me?我希望它得到一个像.jpg或.png这样的图像有人可以帮助我吗? 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/ .如果我理解正确并假设我知道很少的 wordpres(很少),我得到这个链接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.描述了如何重写徽标的模板文件,即 php 文件。

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.首先,在使用 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.否则 go 到外观 > 自定义并查看 Header 选项以更改徽标。

  1. get_template_part( 'template-parts/logo/logo' ); get_template_part('模板部分/标志/标志');

This refers to location template-parts -> logo -> logo.php inside your activated theme.这指的是您激活的主题中的位置模板部件->徽标->徽标.php。 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.因此,适当的解决方案是在您的子主题中创建相同的文件夹和文件,并更改 logo.php 中的代码以直接放置您的徽标文件。

Thanks All for supporting me.谢谢大家支持我。 I have solved my problem by using a simple markup instead of php code that wordpress use.我通过使用简单的标记而不是 wordpress 使用的 php 代码解决了我的问题。 The code markup is:代码标记是:

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

Thanks Again all of you.再次感谢大家。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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