更改WordPress自定义中的网站徽标。

huangapple go评论114阅读模式
英文:

Changing the site logo through WordPress customization

问题

我已为我的网站设计了一个WordPress主题。

我已添加了WordPress代码来控制主题的某些部分,以通过皮肤自定义来实现我想要的更改。

例如,要通过“自定义” >> “站点标识”更改站点标题,我已将以下代码添加到我的模板中:

<?php bloginfo('name'); ?>

此外,为了简短介绍我的网站,我已输入了以下代码,以便随时轻松控制我的网站的简短描述:

<?php bloginfo('description'); ?>

但我找不到更改网站标志的代码,要更改网站的标志,我必须从我的模板文件内更改我为此目的制作的图像,这非常困难且不专业。

我只是在寻找一小段代码,以便我可以像站点标题和简短介绍一样从皮肤自定义中控制网站标志。

英文:

I have designed a WordPress theme for my site.

I have added WordPress codes to control some parts of my theme to make the changes I want through skin customization.

For example, to change the title of the site through Customize >> Site Identity, I have added the following code to my template:

 &lt;?php bloginfo(&#39;name&#39;); ?&gt;

Also, for the short introduction of my site, I have entered the following code so that I can easily control the short description of my site at any time:

&lt;?php bloginfo(&#39;description&#39;); ?&gt;

But I couldn't find a code to change the logo of my site, and to change the logo of the site, I have to change the image I made for this purpose from within my template files, which is very difficult and unprofessional.

I'm only looking for a piece of code so that I can control the site logo from within the skin customization like the site title and short introduction.

答案1

得分: 1

custom-logo主题支持可能是您正在寻找的内容。

使用自定义徽标允许站点所有者上传网站的图像,该图像可以放置在其网站的顶部。您可以从“外观”>“页眉”中上传它,在您的管理面板中。应首先使用add_theme_support()将自定义徽标支持添加到您的主题中,然后在您的主题中使用the_custom_logo()来调用它。自定义徽标是可选的,但如果主题作者将徽标包含在其主题中,应该使用此函数。

来源:
https://developer.wordpress.org/themes/functionality/custom-logo/

英文:

The custom-logo theme support may be what you are looking for.

> Using a custom logo allows site owners to upload an image for their website, which can be placed at the top of their website. It can be uploaded from Appearance > Header, in your admin panel. The custom logo support should be added first to your theme using add_theme_support(), and then be called in your theme using the_custom_logo(). A custom logo is optional, but theme authors should use this function if they include a logo to their theme.

Source:
https://developer.wordpress.org/themes/functionality/custom-logo/

huangapple
  • 本文由 发表于 2023年6月6日 04:39:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/76409852.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定