wordpress - 如何在WordPress中仅为主页添加背景图片

标签 wordpress image background

我一直在研究 WordPress 主题,我想仅为主页添加背景图像,所以请帮助我。

最佳答案

如果 home 获取类“yourClass”,您可以添加到正文标记 php 并在 css 中为该类提供 BG

<body class="<?php if (is_home()){echo 'yourClass';} ?>">

或者提供内嵌背景

<body <?php if (is_home()){echo 'style="background-image:url(images/yourBG.jpg);"';} ?>>

但我更喜欢第一个选项class

祝你好运! :)

关于wordpress - 如何在WordPress中仅为主页添加背景图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27213244/

相关文章:

java - CellTables 和 css (GWT)

wordpress - 为什么我在 mod_pagespeed 中得到 PNG 的 404

WordPress 和 Ubuntu,用于 FTP 的 www-data 和 ubuntu

Android:如何将背景图像设置为给定 "wrap_content"的按钮

javascript - 通过JS获取图像的宽度和高度,然后以cm为单位

image - BlackBerry-在 PersistentStore 中存储图像

css - 一个 div 可以有一个背景图像,但重复不同的图像吗?

php - 添加更新或删除 WooCommerce 运输订单项目

javascript - 当 in 元素在视口(viewport)中可见时自动播放 html 视频

.net - 我的图像很模糊!为什么 WPF 的 SnapsToDevicePixels 不起作用?