小编Atr*_*rag的帖子

为浏览器缓存启用mod_expires

htaccess文件如下所示:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]




</IfModule>
<IfModule mod_expires.c>


# Enable expirations
ExpiresActive On 
# Default directive
ExpiresDefault "access plus 1 month"

# My favicon
ExpiresByType image/x-icon "access plus 1 year"
# Images
ExpiresByType image/gif "access plus 1 week"
ExpiresByType image/png "access plus 1 week"
ExpiresByType image/jpg "access plus 1 week"
ExpiresByType image/jpeg "access plus 1 week"
# CSS
ExpiresByType text/css "access …
Run Code Online (Sandbox Code Playgroud)

apache .htaccess caching browser-cache

5
推荐指数
1
解决办法
1053
查看次数

Onclick函数“未定义”

我对wordpress相当陌生,正在尝试定义和调用函数,但无法使其正常工作。

以下代码显示在一个PHP文件中,该文件使用get_template_part从content.php文件中调用。

<div onclick="checkAllTopicCheckBoxes()"> </div>
Run Code Online (Sandbox Code Playgroud)

我在function.php文件的底部添加了以下代码:

function checkAllTopicCheckBoxes() {
    alert("Hello! I am an alert box!!");
}
Run Code Online (Sandbox Code Playgroud)

当我单击该元素时,它返回:

(索引):363未捕获的ReferenceError:未定义checkAllTopicCheckBoxes。

谁能帮帮我吗?

javascript php wordpress jquery

4
推荐指数
2
解决办法
3万
查看次数

TS2339:属性“getBoundingClientRect”在“从不”类型上不存在

我知道可选链接应该足够了,但我在这里尝试满足 TypeScript 有点过火:

const ref = useRef()

    if (ref !== undefined) {
        if(ref.hasOwnProperty('current')) {
            if (ref.current !== undefined &&  ref.current !== null)
             console.log(ref?.current?.getBoundingClientRect())
        }
    }
Run Code Online (Sandbox Code Playgroud)

错误:

TS2339: Property 'getBoundingClientRect' does not exist on type 'never'.
Run Code Online (Sandbox Code Playgroud)

我想念我不打字的日子......除了 @ts-ignore

typescript reactjs

4
推荐指数
1
解决办法
753
查看次数

"<="附近的意外符号

如果它会告诉我意想不到的符号是什么,那将是如此美妙,但它不会.有人可以告诉我这有什么问题:

for i = 1, 100 do
if i <= 3 then
local rowMenu = 1
elseif <= 6 then
local rowMenu = 2
elseif <= 9 then
local rowMenu = 3
elseif <= 12 then
local rowMenu = 4
elseif <= 15 then
local rowMenu = 5
elseif <= 18 then
local rowMenu = 6
elseif <= 21 then
local rowMenu = 7
elseif <= 24 then
local rowMenu = 8
end
end
Run Code Online (Sandbox Code Playgroud)

我计划计算循环中对象的位置 - 它不完整 - 但我不明白为什么这不起作用.

谢谢.

lua coronasdk

2
推荐指数
1
解决办法
359
查看次数

错误 404 帖子名称永久链接 wordpress

我刚刚将我的 WordPress 站点从 Windows 迁移到 Linux 服务器。除了永久链接设置为 /%postname%/ 的帖子外,一切似乎都有效。我以为这是mod_overwrite问题。

我已将 httpconf 文件从 更改AllowOverride NoneAllowOverride All

然后重置服务器只是为了确保它生效。

我的 .htaccess 看起来像这样:

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Run Code Online (Sandbox Code Playgroud)

我在专用服务器上的 CentOS5 上运行 Apache 2.2。

添加:除了带有这些自定义永久链接的帖子之外,所有页面都在工作。

我已将 .htaccess 的权限设置为 666

apache wordpress .htaccess httpd.conf server

2
推荐指数
1
解决办法
1276
查看次数

顺时针旋转180然后360

我有一个齿轮图标,我想在激活时顺时针旋转180度(class ="cards__cog cards__cog-active"),然后顺时针旋转另一个180度以返回其停用状态(class ="cards__cog cards__cog-inactive").我正在使用React执行此操作,对单击cog时的状态更改做出反应.

以下工作,但我的问题是:

1)它在页面加载时动画(这是有道理的,因为它有cards__cog-inactive类但是替代方案是什么?).

2)它很丑陋,必须有一个更简单的方法.

谢谢

.cards {
    &__cog {
            position: absolute;
            right: 20px;
            top: 20px;
            width: 10vh;
            cursor: pointer;

            &-active {
                 animation: rotate180 1s ease;
                animation-fill-mode: forwards;
            }
            &-inactive {
                animation: rotate180to359to0 1s ease;
                animation-fill-mode: forwards;
            }
       }
}


    @keyframes rotate180 {
      0% {
        transform: rotate(0deg);
      }
      100% {
        transform: rotate(180deg);
      }
    }

    @keyframes rotate180to359to0 {
      0% {
        transform: rotate(180deg);
      }
      99% {
        transform: rotate(359deg);
      }
      100% {
        transform: rotate(0deg);
      }
    }
Run Code Online (Sandbox Code Playgroud)

css css3 css-animations

2
推荐指数
3
解决办法
276
查看次数