简体   繁体   English

Magento Wordpress标头cms块

[英]Magento wordpress header cms block

I have a small question. 我有一个小问题。 I have included a wordpress blog on my magento shop via the fishpig module. 我已经通过fishpig模块在我的magento商店中加入了一个wordpress博客。 This works great but what I want to include are header options via static cms blocks on the blog. 这很好用,但我想包括的是通过博客上的静态cms块进行的标题选项。 I think I need to adjust something in the phtml of the homepage blog. 我想我需要调整主页博客的phtml中的内容。 app/design/frontend/base/default/template/wordpress/homepage.phtml 应用程序/设计/前端/基/默认/模板/ WordPress的/ homepage.phtml

This is the current code: 这是当前代码:

<div class="page-title blog-title <?php if (!$this->isFirstPage()): ?>not-<?php endif; ?>first-page<?php if ($this->isFirstPage() && $this->getTagLine()): ?> with-tagline<?php endif; ?>">
<h1><?php echo $this->escapeHtml($this->getBlogTitle()) ?></h1>
</div>
<?php if ($this->isFirstPage() && $this->getTagLine()): ?>
<p class="blog-desc blog-tag-line"><?php echo $this->escapeHtml($this->getTagLine()) 
?></p>
<?php endif; ?>
<div class="blog-home">
<?php echo $this->getPostListHtml() ?>
</div>

I played arount with the following line of code but I cant get it to work: 我用下面的代码行打了水漂,但是我无法正常工作:

echo $this->getLayout()->createBlock('cms/block')->setBlockId('example_block')->toHTML();   

Any solution would be great!! 任何解决方案都将很棒!

Thanks.. 谢谢..

You can display static blocks on the blog page using this code 您可以使用此代码在博客页面上显示静态块

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('example_block')->toHTML();?>

But first you need to create a static block in the admin panel. 但是首先,您需要在管理面板中创建一个静态块。 Admin-> Cms-> Static blocks. 管理-> Cms->静态块。 Then, after you have specified for the static block title, identifier, status and content, you'll need to replace the block identifier in your code to the identifier of the block that you created in the admin. 然后,在为静态块标题,标识符,状态和内容指定之后,您需要将代码中的块标识符替换为在admin中创建的块的标识符。

For example, you have created a block with identifier "blog_header" means the code to show this block on frontend, will be the 例如,您已经创建了一个标识符为“ blog_header”的块,这意味着在前端显示该块的代码将是

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('blog_header')->toHTML();?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM