如何在WordPress的每个博客/帖子中添加我自己的自定义按钮

时间:2014-04-20 19:22:57

标签: wordpress wordpress-plugin

我想在每个博客中添加自己的按钮。什么时候点击我单独弹出将打开,我的一些计算将在这里完成。与Tweet Share类似,工作正确。

2 个答案:

答案 0 :(得分:0)

您可以使用fancybox打开弹出窗口并在该弹出窗口中显示您的计算。

请参阅fancybox popup here

的演示

请参阅以下示例代码:

<a class="fancybox" href="#inline1" title="My Calculations"><input type="button" value="Mybtn"></a>

<div id="inline1" style="width:400px;display: none;">
// your calculations here
</div>

答案 1 :(得分:0)

感谢朋友们的回答和建议 我解决了这个问题,并在每个帖子中添加了一个我自己的按钮。以下是代码。

add_action('the_content','customFields');
function customFields($text)
    {
        global $post;
        if($post->post_type=='post')
        {
            return $text."<div style='width:100%;text-align:center'><a href=javascript:(function(){var%20url='".$URL;window.open(url,'Yahoo','width=600,height=500');})();><image src='".$imgURL."'/></a></div>";
        }
    }
相关问题