PHP 在Wordpress中创建Thickbox

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP 在Wordpress中创建Thickbox相关的知识,希望对你有一定的参考价值。

<?php  wp_enqueue_style('thickbox');  ?> <!-- inserting style sheet for Thickbox. -->
<?php wp_enqueue_script('jquery'); ?> <!-- including jquery. -->
<?php wp_enqueue_script('thickbox'); ?> <!-- including Thickbox javascript. -->

All these 3 lines of code should insert just before the < ? php wp_head( ) ; ? > function

These codes will include necessary files for your Thickbox. So Thickbox is ready for its functioning. Make sure that you have included < ? php wp_head ( ) ; ? > and < ? php wp_footer( ); ? > in your header and footer files respectively.

Now we can test it by uploading the image from backend by creating a post. Please note that after the image got uploaded, we need to link the thumbnail image to the original image. And we need to include the class for the anchor tag like this. class=”thickbox”.





div {
background: rgb(200, 54, 54); /* The Fallback */
background: rgba(200, 54, 54, 0.5);
}

以上是关于PHP 在Wordpress中创建Thickbox的主要内容,如果未能解决你的问题,请参考以下文章

使用没有插件的thickbox内置的wordpress

php 在wordpress中创建一个cron作业

PHP 在Wordpress function.php文件中创建一个推特小部件

在Wordpress中创建twitter小部件函数.php文件

php EMPTY WIDGET用于在wordpress中创建单个小部件的插件代码。

如何在不引用外部 CSS 文件的情况下在 WordPress PHP 文件中创建内联 CSS?