[wordpress插件] Atom Builder原子生成器

wordpress 插件 文章 2020-02-22 16:50 503 0 全屏看文

AI助手支持GPT4.0

评分
0
描述

This plugin simply allows you to build your page content with widgets instead of using the default page layout for your theme.

此插件仅允许您使用小部件来构建页面内容,而不是使用主题的默认页面布局。

Using the Atom Builder

使用Atom Builder

By default, only basic pages are supported.

默认情况下,仅支持基本页面。

It basically registers a widget area for all of your pages.

它基本上为您所有页面注册了一个小部件区域。

To avoir cluttering the admin area, the newly registered widget areas do not appear alongside your theme’s standard ones, and you have to access them directly in the customizer.

为了避免混乱的管理区域,新注册的窗口小部件区域不会出现在主题的标准区域的旁边,因此您必须直接在定制器中访问它们。

To see it in action :

观看实际效果:

* Just visit any page on your site while logged in, and click the ‘Customize’ link.

*登录后只需访问您网站上的任何页面,然后单击“自定义”链接。

* In the Customizer panel, click on ‘Widgets’ and you should see a widget area registered for your page.

*在“定制程序”面板中,单击“窗口小部件”,您应该会看到为页面注册的窗口小部件区域。

* Just use the widgets you need to build your page content.

*只需使用构建页面内容所需的小部件即可。

This plugin provides you with 3 additional widgets to help you build your page with interesting content and layout: Atom Builder Page, Atom Builder Post, and Atom Builder Posts widgets.

此插件为您提供了3个其他小部件,以帮助您构建具有有趣内容和布局的页面:Atom Builder页面,Atom Builder Post和Atom Builder Posts小部件。

These basic widgets will probably get a bit more complex and have more options in the future, and a few more custom widgets will be added later, but that’s a start.

这些基本的小部件将来可能会变得更加复杂并有更多选择,并且稍后还会添加一些自定义小部件,但这只是一个开始。

Adding theme support for the Atom Builder

为Atom Builder添加主题支持

By default, the Atom Builder replaces your page content using ‘the_content’ filter.

默认情况下,Atom Builder使用“ the_content”过滤器替换页面内容。

That means any markup you have before, such as the title for example, will be kept.

这意味着您之前拥有的任何标记(例如标题)都将保留。

Only your content as it appears in the editor in the admin area is replaced.

仅会替换您在管理区域的编辑器中显示的内容。

If you want to replace the whole content for your page, you’ll have to tweak your theme’s code a little bit.

如果要替换页面的全部内容,则必须稍微调整主题代码。

    • Add theme support for the Atom builder in your child theme’s functions.php file by simply adding this snippet.

      只需添加此代码段,即可在您的子主题的functions.php文件中添加对Atom构建器的主题支持。

      `

      `

      add_action( ‘after_setup_theme’, ‘mythemeprefix_add_atom_builder_support’ );

      add_action('after_setup_theme','mythemeprefix_add_atom_builder_support');

      /**

      / **

        • Add theme support for the Atom Builder
        • 添加对Atom Builder的主题支持

        • This deactivate the basic filter on the_content.

        • 这将禁用the_content上的基本过滤器。

        • Just replace your get_template_part() call in page.php with atom_builder_get_template_part() to replace your whole page content template with registered widgets.

        • 只需用atom_builder_get_template_part()替换page.php中的get_template_part()调用,即可将整个页面内容模板替换为已注册的小部件。

          **/

          ** /

          function mythemeprefix_add_atom_builder_support(){

          函数mythemeprefix_add_atom_builder_support(){

          add_theme_support( ‘atom-builder’ );

          add_theme_support(‘atom-builder’);

          }

          }

          `

        • `

      • Duplicate the page.php template from your theme in your child theme’s folder.

        从您的主题的子主题文件夹中复制page.php模板。

      • Replace the get_template_part() function call with atom_builder_get_template_part(), with the same parameters.

      • 使用相同参数的 atom_builder_get_template_part()替换 get_template_part()函数调用。

        (Basically all you need to do is prefix it.)

      • (基本上,您需要做的就是给它加上前缀。)

      • Now everything should work fine.

      • 现在一切正常。

        Your whole template is replaced with widgets now, not just your content.

      • 您的整个模板现在已替换为小部件,而不仅仅是您的内容。

安装步骤

    1. Upload the plugin files to the /wp-content/plugins/atom-builder directory, or install the plugin through the WordPress plugins screen directly.
    2. 将插件文件上传到 / wp-content / plugins / atom-builder 目录,或直接通过WordPress插件屏幕安装插件。

    3. Activate the plugin through the ‘Plugins’ screen in WordPress
    4. 通过WordPress中的“插件”屏幕激活插件

    5. That’s it !

    6. 就是这样!

      Edit your pages in the customizer and add widgets to your page to see it in action !

    7. 在定制程序中编辑页面,并将小部件添加到页面以查看其实际效果!

下载地址
https://downloads.wordpress.org/plugin/atom-builder.1.0.2.zip
-EOF-

AI助手支持GPT4.0