初心者webデザイナー・コーダーのための備忘録|Tech Stock 【テックストック】

Switch language

当Webサイトのコンテンツ内にはアフィリエイト広告、Googleアドセンス広告が含まれます。
広告主によって不適切な広告が表示されていることに気付いた方は、お手数でございますが該当の広告の「×」を押していただき、「この広告の表示を停止」し所定の流れに従ってください。

[WordPress] Solution when the “Widget” item does not appear in “Appearance”.

> WordPress

At any rate, if you add the source described below to functions.php, it will appear.

“<?php” and “? >” can be deleted if necessary.

The following sources were taken from this site.

http://kawatama.net/web/1278



<?php 
if ( function_exists( 'register_sidebar' ) ) {
 register_sidebar( array(
 'name' => 'widget area 01',
 'id' => 'widget_area01',
 'before_widget' => '<div class=”widget”>',
 'after_widget' => '</div>',
 'before_title' => '<h3>',
 'after_title' => '</h3>'
 ) );
 }
?> 



To add a widget area

We hope that the widget items are displayed safely.

If the widget items have been cleared to appear in the appearance, the next step is to learn how to add a widget area.


============== 2018/12/23 Postscript. ==============

Now, by writing the source introduced at the beginning of this article, “Appearance” -> “Widgets” would have been added to the admin page, but in fact, the earlier source was for adding a widget area.

I had to do a lot of research on Google to solve the problem that “widgets” were not displayed in the first place because I was not very knowledgeable about it at the time I wrote this article.

I was overjoyed to see the “widget” area added to the admin panel after copying and pasting the article.


The result is a success, but we made a mistake in the way we communicated it.

I’m sorry.

The following article provides detailed instructions on how to add a widget area and how to customize the output html tags.

I would like to refer to it if I may.

============== 2018/12/23 Postscript End ==============


As mentioned in this article, you can add a widget area by copying and pasting the following source into functions.php.

Note that “<?php” and “? >” should be omitted and copied and pasted if they are already written in function.php.



 <?php 
if ( function_exists( 'register_sidebar' ) ) {
 register_sidebar( array(
 'name' => 'widget area 01',
 'id' => 'widget_area01',
 'before_widget' => '<div class=”widget”>',
 'after_widget' => '</div>',
 'before_title' => '<h3>',
 'after_title' => '</h3>'
 ) );
 } 
?> 



There is no need to edit “register_sidebar” in this source.

‘name’ => ‘widget area 01’, the part on the right “widget area 01” may be changed freely.

The ‘widget_area01’ in ‘id’ => ‘widget_area01’, must be rewritten to the one and only id, as it is used to call this widget area.

‘before_widget’ => ‘<div class=”widget”>’, and ‘after_widget’ => ‘</div>’, allow you to set tags that surround the general framework of this widget area.

‘before_title’ => ‘<h3>’, and ‘after_title’ => ‘</h3>’ allow you to set tags surrounding the title portion of this widget area.

The following article provides a slightly more detailed explanation of each item, which we hope you will find useful.

For now, you can add a new widget area by putting this description in functions.php of WordPress.

I hope this article is helpful to you.

関連記事

All custom field output methods used by Smart Custom Fields enthusiasts
In my work, I have to customize a WordPress site from scratch and do m



Comments are closed.