【问题标题】:css full width background with content div, wordpress带有内容 div、wordpress 的 css 全宽背景
【发布时间】:2013-06-08 21:00:38
【问题描述】:

我正在为我的作品集网站使用 wordpress 主题,并且我正在尝试重新创建一种我看到许多网站现在都在使用的效果。它本质上是具有标准页面宽度内容的全宽背景图像或 css 背景颜色。

这里是一个例子:http://themeforest.net/item/vernumresponsive-onepage-parallax-wordpress-theme/full_screen_preview/4843905

当您向下浏览大约一半时,您会看到“您准备好购买此主题了吗”部分。它就像内容的分页符。我想在 wordpress 中做到这一点,但我不需要视差效果。我只需要图像背景或背景颜色 css 来破坏初始内容容器,但将其中的内容限制在该容器中。

【问题讨论】:

标签: css wordpress html background width


【解决方案1】:

您可以在主题中使用简码。

示例:

在您的主题中:

function fullWidthBreak_func( $atts ){<br/>
extract( shortcode_atts( array(
'content' => 'default content'
), $atts ) );
return "some css to full widht : $content";<br/>
}<br/>
add_shortcode( 'fullWidthBreak', 'fullWidthBreak_func' );


在您的帖子中:

some content before<br/>
[fullWidthBreak content="some content inside"]
some content after<br/>

参考:

http://codex.wordpress.org/Shortcode_API

【讨论】:

  • 您的代码 sn-p 对我不起作用。我将它添加到 function.php 文件中,但我可能输入错误。但它打破了我目前使用的主题。
猜你喜欢
  • 1970-01-01
  • 2018-04-08
  • 2014-10-30
  • 1970-01-01
  • 2015-07-04
  • 1970-01-01
  • 2023-04-08
  • 2014-05-18
  • 2013-04-01
相关资源
最近更新 更多